Добавьте также пространство имен мыльного конверта в элементе header - PullRequest
0 голосов
/ 21 июня 2019

Заголовок ## Я хочу добавить пространство имен мыльного конверта в элементе заголовка, а также для того, чтобы избежать mustunderstand атрибута XML-синтаксического анализа

Я попытался добавить soapenv: mustUnderstand = "false | true" в XSD,но не повезло.

<xsd:element name="httpRequestHeader" soapenv:mustUnderstand="false">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="Secret" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="Attribute1" type="xsd:string" minOccurs="0" nillable="true"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>

Пожалуйста, найдите ниже мой WSDL

<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://www.myworld.com/myemp/Employee" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  xmlns:tns="http://www.myworld.com/myemp/Employee"
                  xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
                  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <wsdl:types>
    <xsd:schema targetNamespace="http://www.myworld.com/myemp/Employee" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                attributeFormDefault="qualified" elementFormDefault="qualified">
      <xsd:element name="resquestICS">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="winID" type="xsd:string" minOccurs="1" nillable="false"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="responseICS">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="EE_WinID" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="EE_Name" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="EE_Status" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="EE_Email" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="Sup_Win" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="Sup_Email" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="Sup_Name" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="Attribute1" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="Attribute2" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="Attribute3" type="xsd:string" minOccurs="0" nillable="true"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="httpRequestHeader">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="Secret" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="Attribute1" type="xsd:string" minOccurs="0" nillable="true"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
      <xsd:element name="httpResponseHeader">
        <xsd:complexType>
          <xsd:sequence>
            <xsd:element name="Secret" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="Status" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="Description" type="xsd:string" minOccurs="0" nillable="true"/>
            <xsd:element name="Attribute1" type="xsd:string" minOccurs="0" nillable="true"/>
          </xsd:sequence>
        </xsd:complexType>
      </xsd:element>
    </xsd:schema>
  </wsdl:types>
  <wsdl:message name="ResponseHeader" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
    <wsdl:part name="RespHeader" element="tns:httpResponseHeader"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="RequestHeader">
    <wsdl:part name="ReqHeader" element="tns:httpRequestHeader"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="ICSRequestMessage">
    <wsdl:part name="request" element="tns:resquestICS"></wsdl:part>
  </wsdl:message>
  <wsdl:message name="ICSResponseMessage">
    <wsdl:part name="response" element="tns:responseICS"></wsdl:part>
  </wsdl:message>
  <wsdl:portType name="EmployeeDetailsPortType">
    <wsdl:operation name="EmployeeDetails">
      <wsdl:input message="tns:ICSRequestMessage"></wsdl:input>
      <wsdl:output message="tns:ICSResponseMessage"></wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="EmployeeDetailsBinding" type="tns:EmployeeDetailsPortType">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="EmployeeDetails">
      <soap:operation soapAction=""/>
      <wsdl:input>
        <soap:header message="tns:RequestHeader" use="literal" part="ReqHeader"/>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:header message="tns:ResponseHeader" use="literal" part="RespHeader"/>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
</wsdl:definitions>

Ниже приведен ответ SOAP:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header>
      <tns:httpResponseHeader env:mustUnderstand="0" xmlns:tns="http://www.myworld.com/myemp/Employee">
         <tns:Secret>zvz</tns:Secret>
      </tns:httpResponseHeader>
   </env:Header>
   <env:Body>
      <tns:responseICS xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.myworld.com/myemp/Employee" xmlns:nstrgmpr="http://xmlns.oracle.com/types/GetEmployee/InboundSOAPResponseDocument" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
         <tns:EE_Name>vzvv</tns:EE_Name>
      </tns:responseICS>
   </env:Body>
</env:Envelope>

Но я хочу что-то вроде ниже

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
   <env:Header>
      <tns:httpResponseHeader env:mustUnderstand="0" xmlns:tns="http://www.myworld.com/myemp/Employee" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
         <tns:Secret>zvz</tns:Secret>
      </tns:httpResponseHeader>
   </env:Header>
   <env:Body>
      <tns:responseICS xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.myworld.com/myemp/Employee" xmlns:nstrgmpr="http://xmlns.oracle.com/types/GetEmployee/InboundSOAPResponseDocument" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
         <tns:EE_Name>vzvv</tns:EE_Name>
      </tns:responseICS>
   </env:Body>
</env:Envelope>

то есть xmlns: env = "http://schemas.xmlsoap.org/soap/envelope/", который будет добавлен в заголовок -> также элемент tns: httpResponseHeader или удалит сам тег тега mustunderstand из отображаемого в ответе

...