English 中文(简体)
如何根据WSDL档案建立SOAP名称空间
原标题:How to built SOAP Header namespaces based on the WSDL file

我在先提出SOAP请求时,遇到了一些问题。 我认为我没有东西。

我(部分) w想:

<wsdl:definitions   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
                    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
                    xmlns:aws="http://xml.xxx.com"
                    xmlns:security_authenticate_6_1="http://xml.xxx.com/VLSSLQ_06_1_1A" 
                    xmlns:security_authenticatereply_6_1="http://xml.xxx.com/VLSSLR_06_1_1A"
                    targetNamespace="http://xml.xxx.com">  
  <wsdl:types>
    <xsd:schema targetNamespace="http://xml.xxx.com">
      <xsd:import namespace="http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd" schemaLocation="WBS_Session-2.0.xsd"/>      
      <xsd:import namespace="http://xml.xxx.com/VLSSLQ_06_1_1A" schemaLocation="Security_Authenticate_06_1_1A.xsd"/>
      <xsd:import namespace="http://xml.xxx.com/VLSSLR_06_1_1A" schemaLocation="Security_AuthenticateReply_06_1_1A.xsd"/>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="Session" xmlns:ns0="http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd">
    <wsdl:part name="Session" element="ns0:Session"/>
  </wsdl:message>  
  <wsdl:message name="Security_Authenticate_6_1">
    <wsdl:part name="Security_Authenticate_6_1" element="security_authenticate_6_1:Security_Authenticate"/>
  </wsdl:message>
  <wsdl:message name="Security_AuthenticateReply_6_1">
    <wsdl:part name="Security_AuthenticateReply_6_1" element="security_authenticatereply_6_1:Security_AuthenticateReply"/>
  </wsdl:message>
  <wsdl:portType name="XXXWebServicesPT">    
    <wsdl:operation name="Security_Authenticate">
      <wsdl:input message="aws:Security_Authenticate_6_1"/>
      <wsdl:output message="aws:Security_AuthenticateReply_6_1"/>
    </wsdl:operation>    
  </wsdl:portType>
  <wsdl:binding name="XXXWebServicesBinding" type="aws:XXXWebServicesPT">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>    
    <wsdl:operation name="Security_Authenticate">
      <soap:operation soapAction="http://webservices.xxx.com/1ASIWJTUTUA/VLSSLQ_06_1_1A"/>
      <wsdl:input>
        <soap:header message="aws:Session" part="Session" use="literal"/>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:header message="aws:Session" part="Session" use="literal"/>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="XXXWebServices">
    <wsdl:port name="XXXWebServicesPort" binding="aws:XXXWebServicesBinding">
      <soap:address location="https://test.webservices.xxx.com"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

我想诉诸安全——调解行动,在这种情况下,主人必须看像:

<soapenv:Envelope xmlns:soapenv= http://schemas.xmlsoap.org/soap/envelope/ >
    <soapenv:Header>
      <wbs:Session xmlns:wbs= http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd >
        <wbs:SessionId></wbs:SessionId>
        <wbs:SequenceNumber></wbs:SequenceNumber>
        <wbs:SecurityToken></wbs:SecurityToken>
      </wbs:Session>
    </soapenv:Header>
    <soapenv:Body>
      <vls:Security_Authenticate>
        <vls:tagX>
          <vls:tagY>yyy</vls:tagY>
          <vls:tagZ>Z</vls:tagZ>
        </vls:tagX>
      </vls:Security_Authenticate>
    </soapenv:Body>
</soapenv:Envelope>

页: 1

感谢。

问题回答

在您使用xsd的物体之前,你必须宣布名称空间,因此,就你而言,你必须使用会议物体:

<soapenv:Envelope xmlns:soapenv= http://schemas.xmlsoap.org/soap/envelope/ >
  <soapenv:Header>
    <wbs:Session xmlns:wbs= http://xml.xxx.com/ws/2009/01/WBS_Session-2.0.xsd >
      <wbs:SessionId></wbs:SessionId>
      <wbs:SequenceNumber></wbs:SequenceNumber>
      <wbs:SecurityToken></wbs:SecurityToken>
    </wbs:Session>
  </soapenv:Header>
  ...




相关问题
Python SOAP server / client

I have a problem with Python and SOAP. I need to create a web service based on SOAP in Python. I read that I can use libraries like soaplib, suds and ZSI. I created a Hello World web service with ...

HTTP POST and complex structures

I m trying to send a complex HTTP POST request to a web service. The web service was created using VS2008, in which you can set VS to create HTTP POST and GET interfaces alongside the SOAP one. Now ...

XML-RPC Standard and XML Data Type

I was looking at XML-RPC for a project. And correct me if I m wrong, but it seems like XML-RPC has no XML datatype. Are you supposed to pass as a string? or something else? Am I missing something? ...

Most appropriate API for URL shortening service

I ve just finished an online service for shortening URLs (in php5 with Zend Framework); you can enter an URL and you get an short URL (like tinyurl and such sites). I m thinking about the API for ...

What is the best solution for creating a SOAP Server in PHP?

I need some advice on which library is the best choice when it comes to creating SOAP servers (and eventually SOAP clients) in PHP. I know there is built-in functions for this, but is that really the ...

Logging all Soap request and responses in PHP

Does anyone know how to log all request and responses with the builtin SoapClient in PHP? I could in fact manually log everything with SoapClient::__getLastRequest() and SoapClient::__getLastResponse()...

热门标签