How to set SoapAction with SoapJaxbDataFormat - web-services

Hi I am trying to use Camel-SOAP component to create the soap message to invoke a .Net SOAP 1.2 service.
It is not working beacause the the SoapJaxbDataFormat is not putting the SOAP action, I am able to test and call the service using SOAPUI and I see in the request generated by SOAPUI that the soap header with action is filled in.
How can get action filled in ?
SoapJaxbDataFormat soapDF = new SoapJaxbDataFormat("xx.zzz.yy", new ServiceInterfaceStrategy(DpoService.class, true));
soapDF.setVersion("1.2");
soapDF.setNamespacePrefixRef(NAMESPACE_MAPPING_BEAN_NAME);
from("direct:quote")
.marshal(soapDF)
.log("${body}")
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
.setHeader(Exchange.CONTENT_TYPE, constant("application/soap+xml;charset=UTF-8;action=\"http://example.com/services/DpoServiceContract/GetPof\""))
.to("http://localhost:7898/DpoService.svc");
The reason I am using this approach is because the CFX and WSImport generated client code does not work.
I was able to call the service using a velocity template to generate the SOAP msg.
Thank you for your help.

You can set the SOAP action from your message header, just like this:
exchange.getIn().setHeader(Exchange.SOAP_ACTION, "SOAPACTION");

Related

Tool to generate SOAP Request from WSDL

I'm using curl to test my Web services sending SOAP Request. Right now I need some UI tools to generate the sample SOAP Request to be sent. Is there any shell tool (Fedora/RHEL) which lets you generate a SOAP Request from a WSDL ?
Thanks
Check this out, it is a download link for the new SOAP UI tool with added functionality you might require if you don't have it already.
https://sourceforge.net/projects/soapui/

How to turn off Envelope and Body in SOAP request

This is critical to my current project. I have written a client in C++ using Windows web services. This client talks to the Clickatell SMS SOAP web service. I have tested the request using the SOAPUI tool and get correct response. I also receive the SMS message. Now, when I do this programmatically it fails because the WsCall() [in the code generated from WSDL via wsutil.exe) inserts even though the SOAP request I have already includes Envelope and Body. I cannot take out my Envelope since I have namespace specified in it like this:
http://schemas.xmlsoap.org/soap/encoding/\" xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:tns=\"soap.clickatell.com\">
I know that the additional Envelope and Body are inserted since I see it in the Fiddler tool.
Any help I can get is highly appreciated!
Looks like you are using the older type rpc/encoded soap api.
Have you tried using the document/literal service?
(http://api.clickatell.com/soap/document_literal/webservice.php?wsdl)

Servlets and Wsdl file

have a wsdl link and I know the soap request what to send and lso the response format through the membrane soap ui client
I have written a simple html page having 3 fields which i pass through request format of soap and then i get a response based on it. This passing of request and validations are done in servlet which i call through action in form. Now i have a wsdl file link.
How should I use it to make request response from the servlet .please help me with code.
EDIT : THE WSDL CONTAINS WCF BASED SOAP SERVICE .
You have to build a web service client from wsdl using wsimport java utility, then you will get a webservice handle, using that you can build a request, send a request and get a response.
for more details: http://docs.oracle.com/javaee/6/tutorial/doc/bnayn.html

How to pass collection<?> over JAX-WS web service

In my project I need to write a web service which will receive Collection<?> as a parameter.. I am using apache CXF.. After I have written the service method I am unable to test it using SOAP UI (It is not generating any request).. My question is - Is it possible to receive Collection<?> over web service? I need to receive Collection of any object type.. Please help..
You need to work directly with SOAP messages.

soap webservice to return a pojo instead of xml

I'm quite new to webservices, recently started implementing Soap Webservice using Spring-WS and client using Axis and Spring. As i understood, we send xml as request for webservice and we get back response xml. These request/response Xmls can then be marshalled/unmarshalled.
Is there a way to directly return a pojo from webservice and get it on client side with out xml marshall/unmarshalling?
We always end up using Apache Axis and using WSDL2JAVA which produces pojo's for you and hides the service implementation. For the marshaling you can use something like XMLBeans to easily marshal between xml and pojos.
Also see Spring WS Client - How to create mapping POJO for WSDLs without using Axis
Short answer : no.