Reputation: 6188
The web service that calls us expects us to return the following XML:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:loc="http://www.csapi.org/schema/parlayx/sms/notification/v2_2/local">
<soapenv:Header />
<soapenv:Body>
<loc:notifySmsDeliveryReceiptResponse />
</soapenv:Body>
</soapenv:Envelope>
We use JAX-WS to provide our web service. The following is how we define our web service interface:
@BindingType(value = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING)
@WebService (targetNamespace = "http://www.csapi.org/schema/parlayx/sms/notification/v2_2/local")
@HandlerChain(file = "deliverysoaphandler.xml")
@SOAPBinding(style = Style.DOCUMENT)
public interface DeliveryService {
@WebMethod ()
public void notifySmsReception(
@WebParam(name = "correlator", targetNamespace = "http://www.csapi.org/schema/parlayx/sms/notification/v2_2/local") @XmlElement(required = true) String correlator,
@WebParam(name = "message", targetNamespace = "http://www.csapi.org/schema/parlayx/sms/notification/v2_2/local") @XmlElement(required = true) Message message
) throws DeliveryException;
}
This produces the following return document:
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<S:Body>
<ns2:notifySmsReceptionResponse xmlns:ns2="http://www.csapi.org/schema/parlayx/sms/notification/v2_2/local"/>
</S:Body>
</S:Envelope>
We think the document is essential the same as what the calling system expects but gets rejected because 1) the namespaces are capitalized, 2) the same namespace reference is repeated and 3) there is a namespace declaration in the middle of the document.
Is there anyway in which I can persuade the JAX-WS provider to produce what the other system wants?
Upvotes: 0
Views: 1812
Reputation: 3424
Based on this description, I am not sure the namespaces are the problem.
The service consumer is expecting:
<soapenv:Body>
<loc:notifySmsDeliveryReceiptResponse />
</soapenv:Body>
but is receiving
<S:Body>
<ns2:notifySmsReceptionResponse xmlns:ns2="..."/>
</S:Body>
which indicates a response to a different operation name.
Try changing your service endpoint interface WebMethod
method name to:
@WebMethod ()
public void notifySmsDeliveryReceipt(
Doing so will require you to also change the method name on the implementation class (or it will no longer compile).
Alternatively, you can also just change your @WebMethod
to the desired/indicated operation name:
@WebMethod (operationName="notifySmsDeliveryReceipt")
public void notifySmsReception(
The service should now produce:
<S:Body>
<ns2:notifySmsDeliveryReceiptResponse xmlns:ns2="http://www.csapi.org/schema/parlayx/sms/notification/v2_2/local"/>
</S:Body>
Upvotes: 1