How to turn off Envelope and Body in SOAP request - c++

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)

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 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 understand that SOAP webservice use HTTP only for transport?

As I understand RESTful webservices use whole power of http, suffice to say all that rest need is http, but in the same time rest!=http. CRUD provides ability to do any action with API resourses, for example we send http request, this request has header for aunthefication, name of method (for example put), and json in body for updating. How this proces is running via SOAP? SOAP uses XML, but how this XML is delivered to API?
SOAP is based on XML and it conveys that messages are delivered in a SOAP envelope that has a header and a body.
When a SOAP message (be it a request or response) is delivered over HTTP you will have the whole envelope put in the HTTP body.
If the implementation is proper, in the HTTP header, in Content-Type you will have application/soap+xml.
Also in SOAP 1.1 you might have the SOAPAction header, which is not mandatory and is discussed in detail in this article.
See this article for sample raw SOAP request and response. Here is an intro to SOAP that you might also find helpful.
Hope this helps! Good luck.

How to set SoapAction with SoapJaxbDataFormat

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");

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.