on 2016 Mar 25 5:38 PM
Hi,
I would like to perform an http call in json format to call an API that is exposed.
here is my http call method with PUT and i have an error message
com.sap.b1i.xcellerator.XcelleratorException: XCE212 Error performing the HTTP-call, HTTP-status is 404, Not Found
I use a httpCall atom :
<call xmlns="">
<!--identifier-->
<query id="identifier" value="value"></query>
<!--optional - define your own query parameters - multiple elements allowed-->
<connect>
<destProtocol>http</destProtocol>
<destHost>urlmysebservice/</destHost>
<destPort>80</destPort>
<destPath>stocks/</destPath>
<query>1004</query>
<!--<proxyHost></proxyHost>
<proxyPort></proxyPort>-->
<method>PUT</method>
<authentification>basic</authentification>
<user>userws</user>
<password>pwd</password>
<!-- <user2query> </user2query>
<password2query> </password2query>
<trustStoreURI>urlmysebservice</trustStoreURI>
<keyStoreURI></keyStoreURI>-->
</connect>
<!--optional - document type definition-->
<!--<dtd>
</dtd>-->
<pltype>json</pltype>
<!--optional - in case of POST request you specify here your request document-->
<payload>
<xsl:value-of select="/vpf:Msg/vpf:Body/vpf:Payload[./@id='atom3']/text()"></xsl:value-of>
</payload>
<htta>
<!--optional-->
<!--optional - you can specify here your own http header definitions - multiple elements allowed-->
<!-- <par id="httpheader.xml" value="text/xml"></par>
<par id="htta.returnpltypeforce" value="text/xml"></par>
<par id="htta.returnpltypedefault" value="text/xml"></par>-->
<par id="httpheader.???" value="">
<par id="httpheader.Content-Type" value="application/json"></par>
<!--optional - you can specify here your own http header definitions - multiple elements allowed-->
</par>
<par id="htta.returnpltypeforce" value="json"></par>
<par id="htta.returnpltypedefault" value="json"></par>
</htta>
</call>
thanks
Regards,
Lamine
Request clarification before answering.
Hi Lamine,
you already defined the payload type correctly:
<pltype>json</pltype>
as well as the htta segment:
<htta>
<par id="httpheader.???" value="">
<par id="httpheader.Content-Type" value="application/json"/>
</par>
<par id="htta.returnpltypeforce" value="json"/>
<par id="htta.returnpltypedefault" value="json"/>
</htta>
please handover the <payload> as xml and not text or JSON format:
You can find the file with the required schema definition in the BizStore in following place: com.sap.b1i.system/xsd/json_pltype.xsd
You can start with an object using option 1, or with an array, using option 2.
<!--option 1 - starting in the root with an object-->
<io xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:com.sap.b1i.bizprocessor:bizatoms" pltype="json" xsi:schemaLocation="urn:com.sap.b1i.bizprocessor:bizatoms json_pltype.xsd">
<object>
<!-- optional multiple of the following elements-->
<string name="">value</string>
<number name="">value</number>
<object name="">...</object>
<array>...</array>
<bool name="">true/false</bool>
<null name="" />
</object>
</io>
<!-- option 2 - starting in the root with an array-->
<io xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:com.sap.b1i.bizprocessor:bizatoms" pltype="json" xsi:schemaLocation="urn:com.sap.b1i.bizprocessor:bizatoms json_pltype.xsd">
<array>
<!-- optional multiple of the following elements-->
<string name="">value</string>
<number name="">value</number>
<object name="">...</object>
<array>...</array>
<bool name="">true/false</bool>
<null name="" />
</array>
</io>
There are also some json -> xml translators available in the internet to get the correct xml format of your json code.
Best regards
Bastian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bastian,
I follow this way, but have another error.
For detail, see B1IF: Call POST http in json format with error
BR
Robin
| User | Count |
|---|---|
| 23 | |
| 15 | |
| 13 | |
| 6 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.