Understanding documents from a SOAP web service

7

I'm working with a system that provides web service integration, more precisely SOAP.

It provides me with some URLs, which I understand, access, describe, and document the entire system

.

They are:

The documentation shows that the WSDL file can be imported directly into the Visual Studio solution, which, again, as I understand it, generates several classes that interface with the service.

I would like to know if you can use these three URLs (and only them) to understand the service and be able to use it in the program without resorting to other external documents.

And, if so, how to translate the elements contained in these XML's into C # methods.

WSDL excerpts:

<wsdl:message name="GetReservationsRequest">
    <wsdl:part name="body" element="types:GetReservations">
    </wsdl:part>
    <wsdl:part name="credentialsHeader" element="types:UserCredentials">
    </wsdl:part>
</wsdl:message>


<wsdl:message name="CreateSubclipRequest">
    <wsdl:part name="body" element="types:CreateSubclip">
    </wsdl:part>
    <wsdl:part name="credentialsHeader" element="types:UserCredentials">
    </wsdl:part>
</wsdl:message>


<wsdl:message name="GetCustomUserAttributesResponse">
    <wsdl:part name="body" element="types:GetCustomUserAttributesResponse">
    </wsdl:part>
</wsdl:message>
<wsdl:portType name="AssetsPortType">
    <wsdl:operation name="AddReservation">
        <wsdl:documentation> Adds a reservation </wsdl:documentation>
        <wsdl:input message="tns:AddReservationRequest"> </wsdl:input>
        <wsdl:output message="tns:AddReservationResponse"> </wsdl:output>
        <wsdl:fault name="AssetsFault" message="tns:AssetsFault"> </wsdl:fault>
    </wsdl:operation>

    <wsdl:operation name="AddFileMobs">
        <wsdl:documentation> Adds one or more file </wsdl:documentation>
        <wsdl:input message="tns:AddFileMobsRequest"> </wsdl:input>
        <wsdl:output message="tns:AddFileMobsResponse"> </wsdl:output>
        <wsdl:fault name="AssetsFault" message="tns:AssetsFault"> </wsdl:fault>
    </wsdl:operation>


    <wsdl:operation name="CreateFolder">
        <wsdl:documentation> Creates a new folder </wsdl:documentation>
        <wsdl:input message="tns:CreateFolderRequest"> </wsdl:input>
        <wsdl:output message="tns:CreateFolderResponse"> </wsdl:output>
        <wsdl:fault name="AssetsFault" message="tns:AssetsFault"> </wsdl:fault>
    </wsdl:operation>


    <wsdl:operation name="Search">
        <wsdl:documentation> Search for assets </wsdl:documentation>
        <wsdl:input message="tns:SearchRequest"> </wsdl:input>
        <wsdl:output message="tns:SearchResponse"> </wsdl:output>
        <wsdl:fault name="AssetsFault" message="tns:AssetsFault"> </wsdl:fault>
    </wsdl:operation>
<wsdl:operation name="AddReservation">
    <soap:operation soapAction=""/>
    <wsdl:input>
        <soap:header message="tns:AddReservationRequest" use="literal"
          part="credentialsHeader"> </soap:header>
        <soap:body use="literal" parts="body"/>
    </wsdl:input>
    <wsdl:output>
        <soap:body use="literal"/>
    </wsdl:output>
    <wsdl:fault name="AssetsFault">
        <soap:fault name="AssetsFault" use="literal"/>
    </wsdl:fault>
</wsdl:operation>


<wsdl:operation name="AddFileMobs">
    <soap:operation soapAction=""/>
    <wsdl:input>
        <soap:header message="tns:AddFileMobsRequest" use="literal"
          part="credentialsHeader"> </soap:header>
        <soap:body use="literal" parts="body"/>
    </wsdl:input>
    <wsdl:output>
        <soap:body use="literal"/>
    </wsdl:output>
    <wsdl:fault name="AssetsFault">
        <soap:fault name="AssetsFault" use="literal"/>
    </wsdl:fault>
</wsdl:operation>

Excerpts from assets.xsd :

<xsd:element type="tns:AddReservationType" name="AddReservation"/>
<xsd:complexType name="AddReservationType">
    <xsd:annotation>
        <xsd:documentation> Parameters for the AddReservation operation.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
        <xsd:element type="tns:URIListType" name="FolderURIs"/>
        <xsd:element type="xsd:int" name="TimeToExpireInSeconds"/>
        <xsd:element type="tns:ExtensionType" name="Extension" minOccurs="0"/>
        <xsd:any minOccurs="0" processContents="lax" namespace="##other"
          maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:anyAttribute processContents="lax"/>
</xsd:complexType>

<xsd:element type="tns:AddReservationResponseType" name="AddReservationResponse"/>
<xsd:complexType name="AddReservationResponseType">
    <xsd:annotation>
        <xsd:documentation> The response from the AddReservation operation.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
        <xsd:element type="tns:ErrorListType" name="Errors" minOccurs="0"/>
        <xsd:element type="tns:ExtensionType" name="Extension" minOccurs="0"/>
        <xsd:any minOccurs="0" processContents="lax" namespace="##other"
          maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:anyAttribute processContents="lax"/>
</xsd:complexType>

Excerpt from common.xsd :

<xsd:complexType name="AssetDescriptionType">
    <xsd:annotation>
        <xsd:documentation> A pairing of an URI representing an
          asset along with a set of attributes describing it.
        </xsd:documentation>
    </xsd:annotation>

    <xsd:sequence>
        <xsd:element name="URI" type="xsd:string"/>
        <xsd:element name="Attributes" type="tns:AttributeListType"/>
        <xsd:element name="Extension" type="tns:ExtensionType" minOccurs="0"/>
        <xsd:any minOccurs="0" maxOccurs="unbounded" processContents="lax"
          namespace="##other"/>
    </xsd:sequence>
    <xsd:anyAttribute processContents="lax"/>
</xsd:complexType>

What was generated by importing the WSDL into Visual Studio:

    
asked by anonymous 12.04.2017 / 22:16

2 answers

3

The translation of WSDL is as follows:

  • <wsdl:operation> Tags are translated as methods that can be called. They usually have two components: <wsdl:input> and <wsdl:output> , which state the input and output data structures, which in turn are Tags of type <wsdl:message> ;
  • Tags <wsdl:message> are translated as the body of the methods that can be called, and which, in turn, are composed of Tags of type <wsdl:element> ;
  • <wsdl:element> tags are translated as data sets, which can be of type tags <wsdl:complexType> or <wsdl:sequence> ;
  • Tags <wsdl:complexType> are translated as complex input or return objects, consisting of Tags of type <wsdl:sequence> ;
  • Tags <wsdl:sequence> are translated as arguments, which can be input or return parameters. Normally a <wsdl:complexType> contains <wsdl:sequence> ;

This is the summary summary of this here .

I'll get an example of assets.xsd : AddReservation . It is a method. It is expressed here:

<wsdl:operation name="AddReservation">

That is, it can be called this way:

new InterplayWSDemo().AddReservation(/* Coloque os parâmetros aqui */);

The description of what he accepts as arguments is here, but IntelliSense does this work for you.

<xsd:element type="tns:AddReservationType" name="AddReservation"/>

That is, AddReservation is the body of a method that accepts as parameter AddReservationType , which is complex and has some parameters:

<xsd:complexType name="AddReservationType">
    <xsd:annotation>
        <xsd:documentation> Parameters for the AddReservation operation.
        </xsd:documentation>
    </xsd:annotation>
    <xsd:sequence>
        <xsd:element type="tns:URIListType" name="FolderURIs"/>
        <xsd:element type="xsd:int" name="TimeToExpireInSeconds"/>
        <xsd:element type="tns:ExtensionType" name="Extension" minOccurs="0"/>
        <xsd:any minOccurs="0" processContents="lax" namespace="##other"
          maxOccurs="unbounded"/>
    </xsd:sequence>
    <xsd:anyAttribute processContents="lax"/>
</xsd:complexType>

Similarly, you can bring Web Service information like this:

var pesquisa = new InterplayWSDemo().Search(/* Parâmetros de pesquisa conforme SearchRequest */);
    
17.04.2017 / 20:39
0

In your solution, under References, right-click Add Web Reference ..., enter the address: " link "(localhost) is the service on your local computer? check the address. After adding the web reference, the webservice class will be generated with its properties and methods, as well as other classes of the object types that are specified in wsdl

    
14.04.2017 / 17:56