通过WSDL更改SOAP正文中的默认Content-Type

时间:2016-11-03 12:00:45

标签: web-services soap wsdl

我使用Axis2创建了一个Web服务,我想从text / xml更改我的响应的Content-type; charset = UTF-8到text / xml;字符集= UTF-8。

仅当我将Content-type作为text / xml发送时;请求标头中的charset = utf-8,它会正确返回。但就我而言,我没有那种灵活性。所以,我需要找到一种方法来将默认的Content-Type更改为text / xml;字符集= UTF-8。

有人可以就如何改变这个问题提出想法吗?

我尝试过以下类似选项,但没有任何运气。

WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="GradeTenMathService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
  <wsdl:types>
    <xs:schema>
            <xs:import namespace="http://tempuri.org/" schemaLocation="Math.xsd"/>
        </xs:schema>
  </wsdl:types>
  <wsdl:message name="AdditionResponse">
    <wsdl:part name="AdditionRS" element="tns:AdditionResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="AdditionRequest">
    <wsdl:part name="AdditionRQ" element="tns:AdditionRequest">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="DevisionResponse">
    <wsdl:part name="DevisionRS" element="tns:DevisionResponse">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="DevisionRequest">
    <wsdl:part name="DevisionRQ" element="tns:DevisionRequest">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="GradeTenMathPortType">
    <wsdl:operation name="Addition">
      <wsdl:input message="tns:AdditionRequest">
    </wsdl:input>
      <wsdl:output message="tns:AdditionResponse">
    </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="Devision">
      <wsdl:input message="tns:DevisionRequest">
    </wsdl:input>
      <wsdl:output message="tns:DevisionResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="GradeTenMathBinding" type="tns:GradeTenMathPortType">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="Addition">
      <soap:operation soapAction="Addition" style="document"/>
      <wsdl:input>
        <mime:content part="Addition" type="text/xml; charset=utf-8"/>
      </wsdl:input>
      <wsdl:output>
        <mime:content part="Addition" type="text/xml; charset=utf-8"/>
      </wsdl:output>
    </wsdl:operation>
    <wsdl:operation name="Devision">
      <soap:operation soapAction="Devision" style="document"/>
      <wsdl:input>
        <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="GradeTenMath">
    <wsdl:port name="GradeTenMathPort" binding="tns:GradeTenMathBinding">
      <soap:address location="http://localhost:8081/axis2/services/GradeTenMath"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

0 个答案:

没有答案