Whats correct way to use multicall method of magento SOAP API? - ios

I have implemented two ways to call magento methods, first with http://sudzc.com/ classes and second with http://www.wsdl2code.com/Pages/Home.aspx classes. but not getting product info by either way.
Please check two pairs of request and response for multi call method :-
SUDZC
Request:-
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<multiCall>
<sessionId>b543e92c12944a5512c624a4944423d8</sessionId>
<calls>(
"catalog_product.info"
)</calls>
<options>(
productId,
5
)</options>
</multiCall>
</soap:Body>
</soap:Envelope>
Response:-
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:Magento" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns1:multiCallResponse>
<multiCallReturn SOAP-ENC:arrayType="xsd:ur-type[0]" xsi:type="ns1:FixedArray" />
</ns1:multiCallResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Wsdl2code (I think there is problem with soap envelope here, because no param specified inside , let me know how to correct it)
Request:-
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<multiCall xmlns="urn:Magento">
<sessionId>b543e92c12944a5512c624a4944423d8</sessionId>
<calls>
<MagentoService>
<SoapVersion>Default</SoapVersion>
<AllowAutoRedirect>0</AllowAutoRedirect>
<EnableDecompression>0</EnableDecompression>
<UnsafeAuthenticatedConnectionSharing>0</UnsafeAuthenticatedConnectionSharing>
<UseDefaultCredentials>0</UseDefaultCredentials>
<PreAuthenticate>0</PreAuthenticate>
<Url>http://mediaplus.co.za/api/soap/?wsdl/multiCall</Url>
<Timeout>0</Timeout>
</MagentoService>
</calls>
</multiCall>
</soap:Body>
</soap:Envelope>
Response:-
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>Cannot use object of type stdClass as array</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

After lots of googling I have managed to solve this problem by looking at this post.
It has an example project in it.

Related

NetSuite SuiteTalk ReturnAuthorization

I am trying to create a Return Authorization from a Sales Order but can not determine the required parameters.
I keep receiving an error of:
You must enter at least one line item for this transaction.
If I attempt to include the id of one of the line items in the sales order I receive the following error:
Savon::SOAPFault ((soapenv:Server.userException)
com.netledger.util.schemabean.NLSchemaBeanException: id not found on
{urn:customers_2016_2.transactions.webservices.netsuite.com}
ReturnAuthorizationItem
This is my current request
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:platformMsgs="urn:messages_2016_2.platform.webservices.netsuite.com" xmlns:platformCore="urn:core_2016_2.platform.webservices.netsuite.com"
xmlns:platformCommon="urn:common_2016_2.platform.webservices.netsuite.com" xmlns:tranSales="urn:sales_2016_2.transactions.webservices.netsuite.com" xmlns:tranCust="urn:customers_2016_2.transactions.webservices.netsuite.com">
<env:Header>
<platformMsgs:tokenPassport>
<platformCore:account>1234_SB1</platformCore:account>
<platformCore:consumerKey>***FILTERED***</platformCore:consumerKey>
<platformCore:token>***FILTERED***</platformCore:token>
<platformCore:nonce>s975gqhodufgodiueroh</platformCore:nonce>
<platformCore:timestamp>1531918396</platformCore:timestamp>
<platformCore:signature algorithm="HMAC-SHA256">p0z56JDUsN+ksjhfe8HEhdEU(WJff7u+0Yee7Axk=
</platformCore:signature>
</platformMsgs:tokenPassport>
<platformMsgs:preferences>
<platformMsgs:ignoreReadOnlyFields>true</platformMsgs:ignoreReadOnlyFields>
</platformMsgs:preferences>
</env:Header>
<env:Body>
<platformMsgs:add>
<platformMsgs:record xsi:type="tranCust:ReturnAuthorization">
<tranCust:entity internalId="173436">
<platformCore:name>C030420 John Thomas</platformCore:name>
</tranCust:entity>
<tranCust:itemList>
<tranCust:item>
<tranCust:id>21354</tranCust:id>
</tranCust:item>
</tranCust:itemList>
</platformMsgs:record>
</platformMsgs:add>
</env:Body>
</env:Envelope>
If anybody could offer any guidance it would be highly appreciated.
Figured it out, its suppose to be.
<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:platformMsgs="urn:messages_2016_2.platform.webservices.netsuite.com" xmlns:platformCore="urn:core_2016_2.platform.webservices.netsuite.com"
xmlns:platformCommon="urn:common_2016_2.platform.webservices.netsuite.com" xmlns:tranSales="urn:sales_2016_2.transactions.webservices.netsuite.com" xmlns:tranCust="urn:customers_2016_2.transactions.webservices.netsuite.com">
<env:Header>
<platformMsgs:tokenPassport>
<platformCore:account>1234_SB1</platformCore:account>
<platformCore:consumerKey>***FILTERED***</platformCore:consumerKey>
<platformCore:token>***FILTERED***</platformCore:token>
<platformCore:nonce>s975gqhodufgodiueroh</platformCore:nonce>
<platformCore:timestamp>1531918396</platformCore:timestamp>
<platformCore:signature algorithm="HMAC-SHA256">p0z56JDUsN+ksjhfe8HEhdEU(WJff7u+0Yee7Axk=
</platformCore:signature>
</platformMsgs:tokenPassport>
<platformMsgs:preferences>
<platformMsgs:ignoreReadOnlyFields>true</platformMsgs:ignoreReadOnlyFields>
</platformMsgs:preferences>
</env:Header>
<env:Body>
<platformMsgs:add>
<platformMsgs:record xsi:type="tranCust:ReturnAuthorization">
<tranCust:entity internalId="173436">
<platformCore:name>C030420 John Thomas</platformCore:name>
</tranCust:entity>
<tranCust:itemList>
<tranCust:item>
<tranCust:item internalId="22138" type="inventoryItem"/>
</tranCust:item>
</tranCust:itemList>
</platformMsgs:record>
</platformMsgs:add>
</env:Body>
</env:Envelope>
You have to create a initialize for the same.
So once the Sales order is created then we can do a Authorization Return on it once it successfully goes through the process.
More info at : https://docs.oracle.com/en/cloud/saas/netsuite/ns-online-help/section_N3508536.html
Make sure the SOAPAction is set to initialize.

IBM BUS Change Soap Namespace of Responce

My Soap Responce like
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<Response xmlns="http://tempuri.org/">
<Result>
<Result>LOGON FAILED</Result>
</Result>
</Response>
</soapenv:Body>
</soapenv:Envelope>
But, I need change the prefix of namespace and responce and must like this one.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<Response xmlns="http://tempuri.org/">
<Result>
<Result>LOGON FAILED</Result>
</Result>
</Response>
</soapenv:Body>
</soap:Envelope>
If you are using ESQL to construct your message you can do this as described here:
https://www.ibm.com/support/knowledgecenter/SSKM8N_8.0.0/com.ibm.etools.mft.doc/ac67194_.htm
DECLARE soapNs NAMESPACE 'http://schemas.xmlsoap.org/soap/envelope/';
DECLARE tempNs NAMESPACE 'http://tempuri.org/';
SET OutputRoot.XMLNSC.soapNs:Envelope.(XMLNSC.NamespaceDecl)xmlns:soap = soapNs;
SET OutputRoot.XMLNSC.soapNs:Envelope.soapNs:Body.tempNs:Response.(XMLNSC.NamespaceDecl)xmlns = tempNs;
SET OutputRoot.XMLNSC.soapNs:Envelope.soapNs:Body.tempNs:Response.tempNs:Result.tempNs:Result = 'LOGON FAILED';
But still, the value of the namespace tags shouldn't make a difference.

How to work with SOAP that has authentication in iOS

I have a SOAP web service with authentication key.
This is the request
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<FlightSearch xmlns="http://someurl.com/">
<Authkey>string</Authkey>
<from>string</from>
<SesID>string</SesID>
</FlightSearch>
</soap:Body>
</soap:Envelope>
This is response
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<FlightSearchResponse xmlns="http://someurl.com/" />
</soap:Body>
</soap:Envelope>
help me with this to consume data from this. thank

Error about CreateItem operation with attachment

I meet a trouble when using EWS javascript API to send email with CreateItem operation.
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages">
<soap:Header>
<t:RequestServerVersion Version="Exchange2010" />
</soap:Header>
<soap:Body>
<m:CreateItem MessageDisposition="SendAndSaveCopy">
<m:SavedItemFolderId>
<t:DistinguishedFolderId Id="drafts" />
</m:SavedItemFolderId>
<m:Items>
<t:Message>
<t:Subject>Test</t:Subject>
<t:Body BodyType="Text">
Test
</t:Body>
<t:Attachments>
<t:ItemAttachment>
<t:Name>Attached Message Item</t:Name>
<t:Message>
<t:Subject></t:Subject>
<t:Body BodyType="Text">Test</t:Body>
<t:ToRecipients>
<t:Mailbox>
<t:EmailAddress>sunt#domain.com</t:EmailAddress>
</t:Mailbox>
</t:ToRecipients>
</t:Message>
</t:ItemAttachment>
</t:Attachments>
<t:ToRecipients>
<t:Mailbox>
<t:EmailAddress>sunt#domain.com</t:EmailAddress>
</t:Mailbox>
</t:ToRecipients>
</t:Message>
</m:Items>
</m:CreateItem>
</soap:Body>
</soap:Envelope>
And after executing the service request, the response status is succeeded, but the response value indicates there's an error:
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Header>
<h:ServerVersionInfo MajorVersion="15" MinorVersion="0" MajorBuildNumber="847" MinorBuildNumber="40" Version="V2_8" xmlns:h="http://schemas.microsoft.com/exchange/services/2006/types" xmlns="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<m:CreateItemResponse xmlns:m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
<m:ResponseMessages>
<m:CreateItemResponseMessage ResponseClass="Error">
<m:MessageText>Set action is invalid for property.</m:MessageText>
<m:ResponseCode>ErrorInvalidPropertySet</m:ResponseCode>
<m:DescriptiveLinkKey>0</m:DescriptiveLinkKey>
<m:MessageXml>
<t:FieldURI FieldURI="item:Attachments"/>
</m:MessageXml>
<m:Items/>
</m:CreateItemResponseMessage>
</m:ResponseMessages>
</m:CreateItemResponse>
</s:Body>
</s:Envelope>
Can't the CreateItem operation execute with attachment? Or how to succeed with it?

Using Servicestack WSDL with php

I am trying to use ServiceStack to replace WCF for a self hosted service, accessed with a PHP client that forms its messages from on the WSDL.
The WSDL produced by ServiceStack has "part names" called "par" eg:
<wsdl:message name="GetServiceDetailsIn">
<wsdl:part name="par" element="tns:GetServiceDetails" />
</wsdl:message>
Then the SOAP request produced by PHP looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body><par/></SOAP-ENV:Body>
</SOAP-ENV:Envelope>
instead of this from the built-in help:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GetServiceDetails xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:Shout" />
</soap:Body>
</soap:Envelope>
The PHP client has used a par tag instead of GetServiceDetails and it gets a blank response. Can the "part name" definition can be renamed or removed in ServiceStack?
It seems you can't doing anything about this in ServiceStack and its not designed to work with PHP anyway. However you can get it working if you get PHP to tweak the XML tags with find-and-replace, or XSLTs, before sending it.

Resources