IBM BUS Change Soap Namespace of Responce - messagebroker

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.

Related

Parsing SOAP xml using RaptureXML parser

I am working with an iOS application. I need to parse some SOAP XML responses. I am using
RaptureXML parser. It shows empty in "loginResponse" when i parse the XML.
RXMLElement *rootXML = [RXMLElement elementFromXMLString:xmlString encoding:NSUTF8StringEncoding];
RXMLElement *loginResponse = [rootXML child:#"loginResponse"];
Here is my xml:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:partner.soapcom" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<loginResponse>
<result>
<metadataServerUrl>https://um7/services/Soap/m/37.0/00D58000000Zj7H</metadataServerUrl>
<passwordExpired>false</passwordExpired>
<sandbox>false</sandbox>
<serverUrl>https://um7/services/Soap/u/37.0/00D58000000Zj7H</serverUrl>
<sessionId>123456</sessionId>
<userId>123456</userId>
<userInfo>
<accessibilityMode>false</accessibilityMode>
<currencySymbol>£</currencySymbol>
<userUiSkin>Theme3</userUiSkin>
</userInfo>
</result>
</loginResponse>
</soapenv:Body>
</soapenv:Envelope>

Need to add variables to SOAP request without SAVON

I need to be able to add variables to the following XML from the server-side. Is there a way to do this? I cannot use SAVON to handle the request.
data = <<-EOF
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<CheckoutShoppingCart xmlns="http://clients.mindbodyonline.com/api/0_5_1">
<Request>
<XMLDetail>Full</XMLDetail>
<ClientID><!-- client_id goes here --></ClientID>
</Request>
</CheckoutShoppingCart>
</soapenv:Body>
</soapenv:Envelope>
EOF
result= http.post(uri.path, data)
data = <<-EOF
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<CheckoutShoppingCart xmlns="http://clients.mindbodyonline.com/api/0_5_1">
<Request>
<XMLDetail>Full</XMLDetail>
<ClientID>#{client_id}</ClientID>
</Request>
</CheckoutShoppingCart>
</soapenv:Body>
</soapenv:Envelope>
EOF

How to convert string to xml in iOS? (objective C, xcode 7.2)

I want to convert a NSString variable containing xml codes into xml format. My xml request is:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<Authentication xmlns="(namespace link)">
<Credentials>
<Username>username</Username>
<Password>password</Password>
</Credentials>
</Authentication>
</soapenv:Body>
</soapenv:Envelope>
then i saved this request to a NSString variable. And i got response for this as the server didn't recognize as xml. So how to convert the string i saved into xml?
Simple code for SOAP request and parsing.
Goto the link: https://yuvarajmanickam.wordpress.com/2012/10/17/soap-message-request-and-xmlparsing-in-ios-app/
or
github.com/nicklockwood/XMLDictionary
or
stackoverflow.com/questions/803676/encode-nsstring-for-xml-html

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?

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

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.

Resources