Need to add variables to SOAP request without SAVON - ruby-on-rails

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

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>

Validating OAuth2 token in WSO2

I want to use WSO2 for sso. When i'm going to validate token code in SoapUI i'm facing with Invalid access token error.
I registered and i'm redirect to this URL:
http://MyRedirectPage/?code=63873a38-40c6-3240-850c-a50bf7ad8883&session_state=7877d1d733d534206c4247b31d63d95bd3e3dda9d77cd819b4d81e7eeabceb45.Xq6OQiFUARHShBxUZtFHTQ
I'm using code parameter for validation: 63873a38-40c6-3240-850c-a50bf7ad8883
Here is my code in SoapUI:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd" xmlns:xsd1="http://dto.oauth2.identity.carbon.wso2.org/xsd">
<soapenv:Header/>
<soapenv:Body>
<xsd:validate>
<!--Optional:-->
<xsd:validationReqDTO>
<!--Optional:-->
<xsd1:accessToken>
<!--Optional:-->
<xsd1:identifier>63873a38-40c6-3240-850c-a50bf7ad8883</xsd1:identifier>
<!--Optional:-->
<xsd1:tokenType>Bearer</xsd1:tokenType>
</xsd1:accessToken>
<!--Zero or more repetitions:-->
<xsd1:context>
<!--Optional:-->
<xsd1:key>?</xsd1:key>
<!--Optional:-->
<xsd1:value>?</xsd1:value>
</xsd1:context>
<!--Zero or more repetitions:-->
<xsd1:requiredClaimURIs>?</xsd1:requiredClaimURIs>
</xsd:validationReqDTO>
</xsd:validate>
</soapenv:Body>
</soapenv:Envelope>
And here is the result:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns:validateResponse xmlns:ns="http://org.apache.axis2/xsd">
<ns:return xsi:type="ax2395:OAuth2TokenValidationResponseDTO" xmlns:ax2395="http://dto.oauth2.identity.carbon.wso2.org/xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ax2395:authorizationContextToken xsi:nil="true"/>
<ax2395:authorizedUser xsi:nil="true"/>
<ax2395:errorMsg>Invalid access token</ax2395:errorMsg>
<ax2395:expiryTime>0</ax2395:expiryTime>
<ax2395:scope xsi:nil="true"/>
<ax2395:valid>false</ax2395:valid>
</ns:return>
</ns:validateResponse>
</soapenv:Body>
</soapenv:Envelope>
Would you please tell me what is wrong?
It seems you're trying to validate the authorization code. (Why are you doing that?) This service is only for validating access tokens.

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 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?

Resources