Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Java将安全SOAP头与SOAP请求相结合_Java_Web Services_Soap_Wsdl - Fatal编程技术网

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

使用Java将安全SOAP头与SOAP请求相结合,java,web-services,soap,wsdl,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://micr

我有一个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>

此方法用于测试web服务连接性
按日期范围查找当前机构的所有gps点。