- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-11-2016 08:24 AM
I am trying to use SOAP between service now and one of in house applications. I have imported the WSDL and in the test it works fine. However in the workflow it includes the Mimeboundary in the soap body. Here is the Soap function:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:gc10.good.com">
<soapenv:Header>
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-10" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:Username>admin - name</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">Admin - Pass</wsse:Password>
</wsse:UsernameToken>
</wsse:Security></soapenv:Header>
<soapenv:Body>
<urn:GetUsersRequest>
<!--Optional:-->
<urn:offSet>0</urn:offSet> <!--0-->
<!--Optional:-->
<urn:maxResults>1</urn:maxResults><!--1-->
<!--Optional:-->
<urn:getTotal>false</urn:getTotal><!--false-->
<!--Optional:-->
<urn:filter>email</urn:filter>
<!--Zero or more repetitions:-->
<!--You may enter ANY elements at this point-->
</urn:GetUsersRequest>
</soapenv:Body>
</soapenv:Envelope>
The response to the function is as follows:
--MIMEBoundaryurn_uuid_A43470F626032A364A1462980074113
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:A43470F626032A364A1462980074114@apache.org>
<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns2:GetUsersResponse xmlns:ns2="urn:gc10.good.com"><ns2:isPartialResult>false</ns2:isPartialResult><ns2:users><ns2:userId>3238508</ns2:userId><ns2:displayName>Thomas R</ns2:displayName><ns2:stringId>Thomas</ns2:stringId><ns2:domain>ad</ns2:domain><ns2:firstName>Thomas</ns2:firstName><ns2:lastName>Dever</ns2:lastName><ns2:status>1</ns2:status><ns2:policySetId>4088</ns2:policySetId><ns2:userPrincipalName>Thomas</ns2:userPrincipalName><ns2:nativeGuid>556b268acec42a14e4a66eaca4f52</ns2:nativeGuid><ns2:securityRealm>1</ns2:securityRealm><ns2:deviceCount>-1</ns2:deviceCount></ns2:users></ns2:GetUsersResponse></soapenv:Body></soapenv:Envelope>
--MIMEBoundaryurn_uuid_A43470F626032A364A1462980074113--
I have been unsuccessful using the OOB soap message in the workflow by assigning the variables to scratchpad. SO the run script I am trying to use is as follows:
(function() {
try {
var s = new sn_ws.SOAPMessageV2('GC Web Service', 'GetUsers');
s.setSOAPAction("urn:gc10.good.com/gcServer/GetUsersRequest");
var response = s.execute();
var theBody= response.getBody()
gs.log(theBody);
var xmldoc = new XMLDocument2(theBody);
gs.log("THe amswer " + xmldoc.getNodeText("//ns2:userId") + ' : ' + xmldoc.getNodeText("//ns2:domain"));
var responseBody = response.getBody();
var status = response.getStatusCode();
}
catch(ex) {
var message = ex.getMessage();
gs.log("The error " + message)
}
}());
The body responds as the test does, but I can not parse this with Xpath. The getNodeText calls respond with Null values every time.
Thanks for your help!
Solved! Go to Solution.
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2016 05:53 AM
Hi Amila,
Thank you for the response but I was able to get this squared away. Unfortunately the system I was communicating with was send back full content responses and not just the soap response. I was able to split of the mtom mime section of the response. After that, I was able to parse the message correctly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-29-2016 01:57 PM
It seems like you get an MTOM response which is not supported by ServiceNow soap message.
However your response seems does not have any binary content. Please check whether you can send a regular message from your in house service.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-31-2016 05:53 AM
Hi Amila,
Thank you for the response but I was able to get this squared away. Unfortunately the system I was communicating with was send back full content responses and not just the soap response. I was able to split of the mtom mime section of the response. After that, I was able to parse the message correctly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2016 08:21 AM
How were you able to fix this? I'm getting the below message and am not doing anything special like this...
MustUnderstand headers:[{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd}Security] are not understood
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-29-2016 09:02 AM
Where you get this exception?
Your issue may not related to the above one. In SOAP you can set MustUderstand attribute to true. If you receive a SOAP message with such headers your soap engine must process them.
Thanks,
Amila.