使用 SOAP1.2 服务时出现内容类型错误



我在使用 SOAP1.2 服务时遇到问题。我收到此错误:

com.sun.xml.internal.ws.server.UnsupportedMediaException:Unsupported 
Content-Type: text/xml Supported ones are: [application/soap+xml] 
at 
com.sun.xml.internal.ws.encoding.StreamSOAPCodec.decode
(StreamSOAPCodec.java:220)

以下是 WSDL 详细信息和生成的 Java 客户端:

<wsdl:operation name="redeem">
<soap12:operation 
soapAction="http://org.comp.PartnerService
/PartnerConnectorResponder/redeem" style="document" />
-----------------------------------------------------------------------
Client (WSImport Generated)
-----------------------------------------------------------------------
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.8
* Generated source version: 2.2
* 
*/
@WebServiceClient(name = "PartnerService", targetNamespace = 
"http://tempuri.org/", wsdlLocation = "/jaxws/PartnerService_1.wsdl")
public class PartnerService extends Service
{
@WebEndpoint(name = "WSHttpBinding_PartnerConnectorResponder")
public PartnerConnectorResponder getConnectorResponder() {
return super.getPort(
new QName("http://tempuri.org/", 
"PartnerConnectorResponder"), 
,PartnerConnectorResponder.class);
}
}
-----------------------------------------------------------------------
Invocation: [Pseudo code]
-----------------------------------------------------------------------
fun redeem() {
var soapClient:PartnerConnectorResponder = getConnectorResponder()
var bindingProvider:BindingProvider=(soapClient asBindingProvider)
bindingProvider.getRequestContext().put("Content-Type", "application/soap+xml")
//Also tried lower 't' in type but no luck
//bindingProvider.getRequestContext().put("Content-type", "application/soap+xml")
bindingProvider.redeem();
}

该代码以某种方式设置了 SOAP 1.1 (text/xml( 的默认内容类型。即使我手动设置了内容类型,它仍然失败并出现相同的错误。

我真的很感激任何意见,因为我已经被困了一个星期了。谢谢。

通过将以下属性添加到 SOAP 客户端来解决该问题: 寻址功能(真(

相关内容

  • 没有找到相关文章

最新更新