locked
Can't make a proper web service reference. RRS feed

  • Question

  • I have raw WSDL, which must be edited to make a proper web service reference:

    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ota="http://www.opentravel.org/OTA/2003/05" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.opentravel.org/OTA/2003/05" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01cext-1.0.xsd" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy/">
      <!--
      original tags:
      <wsp:UsingPolicy n1:Required="true"/>
      <wsp:Policy s0:Id="Auth.xml">
      -->
      <wsp:UsingPolicy wsp:Required="true"/>
      <wsp:Policy wsp:Id="Auth.xml">  
        <wsse:Identity>
          <wsse:SupportedTokens>
            <wsse:SecurityToken TokenType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#UsernameToken">
              <wsse:UsePassword Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"/>
            </wsse:SecurityToken>
          </wsse:SupportedTokens>
        </wsse:Identity>
      </wsp:Policy>
      <!-- Define data types (import OTA schemas) -->
      <wsdl:types>
        <xs:schema>
          <xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="OTA_AirLowFareSearchRQ.xsd"/>
        </xs:schema>
        <xs:schema>
          <xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="OTA_AirLowFareSearchRS.xsd"/>
        </xs:schema>
      </wsdl:types>
      <!-- Define request and response messages-->
      <wsdl:message name="AirLowFareSearchRequest">
        <wsdl:part name="OTA_AirLowFareSearchRQ" element="ota:OTA_AirLowFareSearchRQ"/>
      </wsdl:message>
      <wsdl:message name="AirLowFareSearchResponse">
        <wsdl:part name="OTA_AirLowFareSearchRS" element="ota:OTA_AirLowFareSearchRS"/>
      </wsdl:message>
      <!-- Define operation and reference messages-->
      <wsdl:portType name="AirLowFareSearchPort">
        <wsdl:operation name="AirLowFareSearch">
          <wsdl:input message="ota:AirLowFareSearchRequest"/>
          <wsdl:output message="ota:AirLowFareSearchResponse"/>
        </wsdl:operation>
      </wsdl:portType>
      <!-- Define SOAP binding-->
      <wsdl:binding name="AirLowFareSearchBinding" type="ota:AirLowFareSearchPort">
        <!-- Use document style and not rpc-->
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="AirLowFareSearch">
          <!-- Use 'literal' to include OTA XML as-is-->
          <soap:operation soapAction="" style="document"/>
          <wsdl:input>
            <soap:body use="literal"/>
          </wsdl:input>
          <wsdl:output>
            <soap:body use="literal"/>
          </wsdl:output>
        </wsdl:operation>
      </wsdl:binding>
      <!-- Define SOAP interface with previously declared binding-->
      <wsdl:service name="AirLowFareSearchService">
        <wsdl:port name="AirLowFareSearchPort" binding="ota:AirLowFareSearchBinding">
          <!-- Replace "http://mydomain/myservicename" with actual service endpoint-->
          <soap:address location="http://mydomain/myservicename"/>
        </wsdl:port>
      </wsdl:service>
    </wsdl:definitions>
    
    I change the soap:address tag to point to the correct web service address. But I don't really know what to do with the
      <wsp:UsingPolicy n1:Required="true"/>
      <wsp:Policy s0:Id="Auth.xml">
    
    part. The n1 and s0 namespaces are not declared, so I changed them to "wsp".
    After I make a reference and try to use this method I get "WSDoAllReceiver: Request does not contain required Security header" exception. I know that the authorization information must be supplied in the header of the soap message (I can give an example XML), but I don't understand how to include it there.
    The support can't help with that, so I am asking here.
    Can anybody help with that?
    Thursday, May 28, 2009 11:14 AM

Answers

  • I didn't succeed in making a web reference here, so I decided to comunicate with the web service using WebRequest :)
    Tuesday, September 29, 2009 7:56 AM

All replies

  • This WSDL is using WS-Security, which is not supported by the old ASMX web services. You should use WCF instead ("Add Service Reference").

    John Saunders
    Use File->New Project to create Web Service Projects
    Use WCF for All New Web Service Development, instead of old ASMX or obsolete WSE
    Friday, May 29, 2009 10:25 PM
    Moderator
  • I am working under .NET 2.0, so I can not use WCF.
    Monday, June 1, 2009 7:38 AM
  • You don't have any good choices. You can use Web Service Extensions (WSE 3.0), but it's obsolete. It's not even supported by VS 2008 or above. It might work, but then you're stuck with something obsolete until you can upgrade to WCF.

    Is there a reason you can't upgrade to .NET 3.5 SP1? As far as existing .NET 2.0 applications are concerned, it's just a service pack (.NET 2.0 SP2, to be exact).
    John Saunders
    Use File->New Project to create Web Service Projects
    Use WCF for All New Web Service Development, instead of old ASMX or obsolete WSE
    Monday, June 1, 2009 1:46 PM
    Moderator
  • No, I really can't upgrade to .NET 3.5 .
    I have WSE 3.0 installed, should it modify the web service reference in some way? Should some header properties appear in the proxy class?
    Monday, June 1, 2009 2:04 PM
  • Sorry, I know very little about WSE besides the fact that it's obsolete.

    I find that if a question has "WSE" in the subject, that it is more likely to draw attention from those who know about WSE.
    John Saunders
    Use File->New Project to create Web Service Projects
    Use WCF for All New Web Service Development, instead of old ASMX or obsolete WSE
    Monday, June 1, 2009 5:31 PM
    Moderator
  • I didn't succeed in making a web reference here, so I decided to comunicate with the web service using WebRequest :)
    Tuesday, September 29, 2009 7:56 AM