Hello forum
This is my first post and I hope you guys can help.
I am a vb.net programmer but I'm new to web services. I've been given a WSDL from a third party which contains many function calls but I'm only interested in one. The 'CreateShipment' takes one input parameter (WSDL message 'CreateShipmentRequest') and responds with one output parameter (WSDL message 'CreateShipmentReply'). The input parameter is actually an xml file.
I've successfully imported the WSDL into my vb.net project as a web reference and the vb intellisense can see functions inside the WSDL.
There is lots of discussion on the web regarding creating SOAP wrappers but I am hoping that .net will handle all that stuff and all I will have to do pass the xml as a string into the 'CreateShipmentRequest' call and receive the response via 'CreateShipmentReply'
Am I being naive as I can't see any way of passing the xml string into CreateShipmentRequest.
Any help would be much appreciated.
I've included the relevant parts of the WSDL at the bottom of this post.
note I've named the imported WSDL web reference as 'webservice'
My attempt so far...
Dim myxml as string 'this will contain an xml string. not used in code below as i cant see how to pass it in
Dim MyService As webservice.ShipService = New webservice.ShipService 'name of the service as specified at the bottom of the WSDL
Dim myresult As webservice.CreateShipmentReply
Dim myrequest As webservice.CreateShipmentRequest = New webservice.CreateShipmentRequest
myresult = MyService.createShipment(myrequest)
There are no intellisense errors but I can't see how to pass the xml string into CreateShipmentRequest.
Relevant parts of the WSDL...
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ns="http://www.thirdparty.net/ws/ship/v1"
targetNamespace="http://www.thirdparty.net/ws/ship/v1"
name="ShipServiceDefinitions">
<types>
<xs:schema
attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://www.thirdparty.net/ws/ship/v1"
xmlns:ns="http://www.thirdparty.net/ws/ship/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="CreateShipmentRequest" type="ns:CreateShipmentRequest"/>
<xs:element name="CreateShipmentReply" type="ns:CreateShipmentReply"/>
...etc
<xs:complexType name="CreateShipmentRequest">
<xs:complexContent>
<xs:extension base="ns:BaseRequest">
<xs:sequence>
<xs:element name="RequestedShipment" type="ns:RequestedShipment"></xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="CreateShipmentReply">
<xs:complexContent>
<xs:extension base="ns:BaseReply">
<xs:sequence>
<xs:element name="CompletedShipmentInfo" type="ns:CompletedShipmentInfo"></xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
...etc
<message name="CreateShipmentRequest">
<part name="CreateShipmentRequest" element="ns:CreateShipmentRequest"/>
</message>
<message name="CreateShipmentReply">
<part name="CreateShipmentReply" element="ns:CreateShipmentReply"/>
</message>
...etc
<portType name="ShipPortType">
<operation name="createShipment" parameterOrder="CreateShipmentRequest">
<input message="ns:CreateShipmentRequest"/>
<output message="ns:CreateShipmentReply"/>
</operation>
...etc
<binding name="ShipServiceSoapBinding" type="ns:ShipPortType">
<s1:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="createShipment">
<s1
peration soapAction="createShipment" style="document"/>
<input>
<s1:body use="literal"/>
</input>
<output>
<s1:body use="literal"/>
</output>
</operation>
...etc
<service name="ShipService">
<port name="ShipServicePort" binding="ns:ShipServiceSoapBinding">
<s1:address location="https://exact.thirdparty.net/ws/"/>
</port>
</service>
This is my first post and I hope you guys can help.
I am a vb.net programmer but I'm new to web services. I've been given a WSDL from a third party which contains many function calls but I'm only interested in one. The 'CreateShipment' takes one input parameter (WSDL message 'CreateShipmentRequest') and responds with one output parameter (WSDL message 'CreateShipmentReply'). The input parameter is actually an xml file.
I've successfully imported the WSDL into my vb.net project as a web reference and the vb intellisense can see functions inside the WSDL.
There is lots of discussion on the web regarding creating SOAP wrappers but I am hoping that .net will handle all that stuff and all I will have to do pass the xml as a string into the 'CreateShipmentRequest' call and receive the response via 'CreateShipmentReply'
Am I being naive as I can't see any way of passing the xml string into CreateShipmentRequest.
Any help would be much appreciated.
I've included the relevant parts of the WSDL at the bottom of this post.
note I've named the imported WSDL web reference as 'webservice'
My attempt so far...
Dim myxml as string 'this will contain an xml string. not used in code below as i cant see how to pass it in
Dim MyService As webservice.ShipService = New webservice.ShipService 'name of the service as specified at the bottom of the WSDL
Dim myresult As webservice.CreateShipmentReply
Dim myrequest As webservice.CreateShipmentRequest = New webservice.CreateShipmentRequest
myresult = MyService.createShipment(myrequest)
There are no intellisense errors but I can't see how to pass the xml string into CreateShipmentRequest.
Relevant parts of the WSDL...
<?xml version="1.0" encoding="UTF-8"?>
<definitions
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:s1="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:ns="http://www.thirdparty.net/ws/ship/v1"
targetNamespace="http://www.thirdparty.net/ws/ship/v1"
name="ShipServiceDefinitions">
<types>
<xs:schema
attributeFormDefault="unqualified"
elementFormDefault="qualified"
targetNamespace="http://www.thirdparty.net/ws/ship/v1"
xmlns:ns="http://www.thirdparty.net/ws/ship/v1"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="CreateShipmentRequest" type="ns:CreateShipmentRequest"/>
<xs:element name="CreateShipmentReply" type="ns:CreateShipmentReply"/>
...etc
<xs:complexType name="CreateShipmentRequest">
<xs:complexContent>
<xs:extension base="ns:BaseRequest">
<xs:sequence>
<xs:element name="RequestedShipment" type="ns:RequestedShipment"></xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:complexType name="CreateShipmentReply">
<xs:complexContent>
<xs:extension base="ns:BaseReply">
<xs:sequence>
<xs:element name="CompletedShipmentInfo" type="ns:CompletedShipmentInfo"></xs:element>
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
...etc
<message name="CreateShipmentRequest">
<part name="CreateShipmentRequest" element="ns:CreateShipmentRequest"/>
</message>
<message name="CreateShipmentReply">
<part name="CreateShipmentReply" element="ns:CreateShipmentReply"/>
</message>
...etc
<portType name="ShipPortType">
<operation name="createShipment" parameterOrder="CreateShipmentRequest">
<input message="ns:CreateShipmentRequest"/>
<output message="ns:CreateShipmentReply"/>
</operation>
...etc
<binding name="ShipServiceSoapBinding" type="ns:ShipPortType">
<s1:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="createShipment">
<s1
<input>
<s1:body use="literal"/>
</input>
<output>
<s1:body use="literal"/>
</output>
</operation>
...etc
<service name="ShipService">
<port name="ShipServicePort" binding="ns:ShipServiceSoapBinding">
<s1:address location="https://exact.thirdparty.net/ws/"/>
</port>
</service>