Pass an operation to a WSDL in xml
I want to send an operation request to a WSDL and have attempted to use the Webrequest activity. I can run the workflow and the definition of the WSDL is returned. How do I pass a specific operation and parameters (in xml) to the WSDL. The xml I'm wanting to pass looks something like this:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns0="urn:Document">
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<tns0:getDocumentsByExternalId>
<in1 xsi:type="xsd:string">105970</in1>
<in2 xsi:type="xsd:string">USERNAME</in2>
<in3 xsi:type="xsd:string">PASSWORD</in3>
<in4 xsi:type="xsd:boolean">true</in4>
</tns0:getDocumentsByExternalId>
</soap:Body>
</soap:Envelope>
I've looked at the various examples of Web Request with Headers that Ryan Cooney created but I'm not finding what I think I need. Any help would be appreciated.
-
Hi Dan,
I did something similiar using a C# script based on an example I found in the forum. Here's a link:
(https://support.geocortex.com/essentialsGSCForum?sub-nav=forum&main-nav=essentials&feedtype=SINGLE_QUESTION_SEARCH_RESULT&id=90660000000092QAAQ) "How to set Content-Type in a webrequest"
You basically have to build your request payload as a string and use the C# WebClient to post.
I pass values from the selected feature in as arguments using "RunWorkflowWithArguments" (in this case a "gisid"). The activity paramaters I have set are:
- url (this is a string that contains the service endpoint)
- gisId (this is a string to hold the argument value of the identified feature)
- response (this is a byte-array to store the response from the web service call)
Here is the C# script activity from my workflow:
using(WebClient client = new WebClient())
{
byte[] soapMsg = System.Text.Encoding.Default.GetBytes("<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'><s:Body><GetRecords><gisid>" + gisId + "</gisid></GetRecords></s:Body></s:Envelope>");
client.Headers[HttpRequestHeader.ContentType] = "text/xml; charset=utf-8";
client.Headers.Add("SOAPAction", "urn:Service/GetRecords");
response = client.UploadData(url, "POST", soapMsg);
}Hope this helps!
0 -
Thanks David!
I'll give this a try and post my results.
Dan
0
Please sign in to leave a comment.
Comments
2 comments