Reputation: 195
I am trying to invoke Web Service (Version 1.2 and dont have a Version 1.1 for this service) using Java/Groovy code. I have tried below options
Using SAAJ
String endpointURL = <<endpoint>>
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection soapConnection = soapConnectionFactory.createConnection();
// Send SOAP Message to SOAP Server
def Request = <<Request XML>>
InputStream is = new ByteArrayInputStream(Request.getBytes());
SOAPMessage soapMessage = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL).createMessage(null, is);
SOAPMessage soapResponse = soapConnection.call(soapMessage, endpointURL)
Using Groovy WsLite
def client = new SOAPClient(<<endpoint>>)
def response = client.send(SOAPVersion.V1_2, <<RequestXML>>)
In both cases the I am receivig and error from service indicating version mismatch. Underlying architecture is Oracle Service Bus.
I am able to invoke Web Services which are available with both Versions 1.1 and 1.2 with the same code. I am suspecting that in this case we are able to invoke only Service belonging to version 1.1
Could someone help me understand what is that I am missing here?
Upvotes: 0
Views: 1224
Reputation: 195
The issue was resolved by adding SOAPAction as mimeheader in case of SOAP version 1.2. I was able to resolve this issue by passing SOAPAction along with the SOAPVersion
In case of SAAJ passed
MimeHeaders mimeh = message.getMimeHeaders();
mimeh.addHeader("SOAPAction",<<soapaction>>);
In case of Groovy wslite
def response = client.send(SOAPVersion.V1_2, SOAPAction: <<soapaction>>,<<RequestXML>>)
Upvotes: 2
Reputation: 346
Your underlying oracle service bus might be configured to support only SOAP 1.1 version. Did you change your code to use SOAPConstants.SOAP_1_1_PROTOCOL and try the same.
If this works, your OSB has to be enabled to support both 1.1 and 1.2 soap versions.
Thanks
Upvotes: 0