使用Java将安全的SOAP标头与SOAP请求相结合

时间:2014-01-15 14:26:20

标签: java web-services soap wsdl

我有这个WSDL文件,我使用wsimport将它变成JAVA程序。在我这样做之后,当我去发出Web请求时会导致问题,因为SecureSOAPHeader没有附加到Web请求。我需要帮助将标题附加到请求。请帮忙!

 <?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://"Place"/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://"Place"/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://"Place"/">
      <s:element name="Welcome">
        <s:complexType />
      </s:element>
      <s:element name="WelcomeResponse">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="WelcomeResult" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="List"Service"">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="startDate" type="s:string" />
            <s:element minOccurs="0" maxOccurs="1" name="endDate" type="s:string" />
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="List"Service"Response">
        <s:complexType>
          <s:sequence>
            <s:element minOccurs="0" maxOccurs="1" name="List"Service"Result">
              <s:complexType>
                <s:sequence>
                  <s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" />
                </s:sequence>
              </s:complexType>
            </s:element>
          </s:sequence>
        </s:complexType>
      </s:element>
      <s:element name="SecureSOAPHeader" type="tns:SecureSOAPHeader" />
      <s:complexType name="SecureSOAPHeader">
        <s:sequence>
          <s:element minOccurs="0" maxOccurs="1" name="customerNumber" type="s:string" />
          <s:element minOccurs="0" maxOccurs="1" name="password" type="s:string" />
        </s:sequence>
        <s:anyAttribute />
      </s:complexType>
    </s:schema>
  </wsdl:types>
  <wsdl:message name="WelcomeSoapIn">
    <wsdl:part name="parameters" element="tns:Welcome" />
  </wsdl:message>
  <wsdl:message name="WelcomeSoapOut">
    <wsdl:part name="parameters" element="tns:WelcomeResponse" />
  </wsdl:message>
  <wsdl:message name="List"Service"SoapIn">
    <wsdl:part name="parameters" element="tns:List"Service"" />
  </wsdl:message>
  <wsdl:message name="List"Service"SoapOut">
    <wsdl:part name="parameters" element="tns:List"Service"Response" />
  </wsdl:message>
  <wsdl:message name="List"Service"SecureSOAPHeader">
    <wsdl:part name="SecureSOAPHeader" element="tns:SecureSOAPHeader" />
  </wsdl:message>
  <wsdl:portType name="GPSSoap">
    <wsdl:operation name="Welcome">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">This method is to be used to test web service connectivity</wsdl:documentation>
      <wsdl:input message="tns:WelcomeSoapIn" />
      <wsdl:output message="tns:WelcomeSoapOut" />
    </wsdl:operation>
    <wsdl:operation name="List"Service"">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Finds all gps points for current agency by date range.</wsdl:documentation>
      <wsdl:input message="tns:List"Service"SoapIn" />
      <wsdl:output message="tns:List"Service"SoapOut" />
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="GPSSoap" type="tns:GPSSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="Welcome">
      <soap:operation soapAction="http://"Place"/Welcome" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="List"Service"">
      <soap:operation soapAction="http://"Place"/List"Service"" style="document" />
      <wsdl:input>
        <soap:body use="literal" />
        <soap:header message="tns:List"Service"SecureSOAPHeader" part="SecureSOAPHeader" use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="GPSSoap12" type="tns:GPSSoap">
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
    <wsdl:operation name="Welcome">
      <soap12:operation soapAction="http://"Place"/Welcome" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="List"Service"">
      <soap12:operation soapAction="http://"Place"/List"Service"" style="document" />
      <wsdl:input>
        <soap12:body use="literal" />
        <soap12:header message="tns:List"Service"SecureSOAPHeader" part="SecureSOAPHeader" use="literal" />
      </wsdl:input>
      <wsdl:output>
        <soap12:body use="literal" />
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="GPS">
    <wsdl:port name="GPSSoap" binding="tns:GPSSoap">
      <soap:address location="http://"Place"" />
    </wsdl:port>
    <wsdl:port name="GPSSoap12" binding="tns:GPSSoap12">
      <soap12:address location="http://"Place"" />
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

0 个答案:

没有答案