Adding soap headers in apache camel - wso2

I am calling a soap web service from Apache Camel, which is having header (for authentication) and the body. My Dataformat is POJO (tried with PAYLOAD too) Nothing got succeeded.
echange.getIn().setHeader() is not working (Checking the request using tcpmon)
Any suggestion or coding will be helpful.

Please refer http://camel.apache.org/cxf.html
Hope this is helpful.

Related

Wsdl file changed on new server

We have deployed our webservice in liberty server.Earlier it was on IBM WAS. After deploying in liberty, we came to know that Webservices is running on CXF webservice framework. In WAS, it was Axis framework.
Another difference is that , changes happened in wsdl url & content. The old wsdl url is http://localhost:8080/Hello/HelloServices/Helloservices.wsdl and it contains xsd schema definition.
In the liberty server above wsdl url is not working and throwing file not found. But if we try to invoke http://localhost:8080/Hello/HelloServices?wsdl it's working.
Could anyone tell why old url is not working in New server. Is it due to server or inbuilt cxf framework in server.
Another team is using wsdl url to consume this webservice, with this new url they are not able to achieve it.
Any thoughts or suggestions are appreciated..
Thanks in Advance
The main reason for this is the change in the JAX-WS implementations used by the different WebSphere profiles. CXF, unfortunately, hard codes the WSDL url to append ?wsdl in several locations and so this is something that is not possible to change in configuration. The easiest solution would to add a ServletFilter to check the incoming request url for http://localhost:8080/Hello/HelloServices/Helloservices.wsdl and then redirect the request to http://localhost:8080/Hello/HelloServices/Helloservices?wsdl.
There's a good SO post that shows how to write a ServletFilter to redirect here:
How to use a servlet filter in Java to change an incoming servlet request url?
The other option would be to have the client side update either their code or configuration to account for the change to the WSDL URL.

How to find if a webpage uses REST or SOAP web services?

Is there a way to find out if a webpage uses REST or SOAP web services in it's back-end? If there is a way then what is it?
Thank you
You can check the network requests using a browsers developer tools.
Checking the headers for text/xmland a SOAP envelope might indicate SOAP
If its using REST you can check to see the header method is using GET, PUT, POST, DELETE with application/json which might indicate REST
SEE:
How can I debug a HTTP POST in Chrome?
And an in depth explanation of what I mean by "might be":
Representational state transfer (REST) and Simple Object Access Protocol (SOAP)

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)

User defined log files for SOAP requests and Responses in Websphere 8

I have a Soap based web services running in websphere 8. Since we have he trace.log, which have the Webservices request and response XML. I am trying to log it to a different file apart from trace.log.
To be very precise, If my service is HelloWorldService. I would like to log the SOAP requests in service_helloworld.log. I have defined the appenders and loggers in log 4j already. But I am looking into a way where I could configure websphere to redirect the webservices traces to that file.
I still could write a interceptor, but I am trying it in websphere configs. Please help
I don't know if you still have that problem... But I had the same one and I just fix it implementing a GenericHandler that interceps the request/response.
Take a look:
http://www.ibm.com/developerworks/websphere/library/techarticles/0511_phung-lu/0511_phung-lu.html

Send/Receive a SOAP request using SPRING JAVA

I am new to Spring web services. I am going to create an xml request, and send it as a SOAP request to a web service and receive the response.I read different documents but still confused as I could not find a working sample yet.
I know that I should use WebServiceTemplate and WebServiceMessageSender, SaajSoapmessageFactory (please let me know if I am wrong) but not sure how to use them.
Do I need WSDL? if yes why?
If you have any sample code please send me to get clear on it.
Thanks
If you want to send SOAP requests, you would like to be a SOAP client. Seems like you want to use spring-ws project. Check out their great documentation on the client side. The same documentation will guide you through the process of creating a server. There are plenty of examples and ready-made configuration snippets waiting for you.
Spring-WS is built on top of XML Schema description of your message, so you will need WSDL to generate e.g. JAXB models of your requests and responses.
AFAIK, for "web services" , the WSDL file is the machine blueprint of the "ports" as they are called However! ports in WSDL "means" java language(or any other programming language used with a routine or sub or procedure or function) method and has a specific naming scheme associate the .wsdl xml file(template of the service). Each WSDL port(language method) has specifications of return value and data specifications for how to feed it arguments and their type values.