У меня проблемы с использованием сервиса 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).Даже после того, как я вручную установил тип контента, он все равно не работает с той же ошибкой.
Я был бы очень признателен за любые входные данные, поскольку я застрял на этой неделе. Спасибо.