• Post Reply Bookmark Topic Watch Topic
  • New Topic

Sending a SOAP message via HTTP  RSS feed

 
Giriraj Bhojak
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I have a requirement wherein I need to send a SOAP message via HTTP to another application and expect a response.
I don't have a need to create a WSDL or use web services.
I simply need to create a SOAP message, apply WS security and send it via HTTP.
I am not aware of any existing SOAP implementations that would aid in this task. I need to implement a request-response model.
Could anyone please help me find such a framework?

Thanks,
Giriraj.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are both your client and the "other application" under your control?

1. I don't have a need to create a WSDL or use web services.
2. I simply need to create a SOAP message, apply WS security and send it via HTTP.


But WS security (2) is a web services (1) function!?

Why are you so sure you need a "SOAP message"?

Bill
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would also ask "how is sending SOAP over HTTP not a web service"? If by that you mean that you don't want to use any of the common WS frameworks (why?), I advise to drop that notion right now. WS-Security is not trivial to apply, you'll be much happier having a framework do that for you instead of implementing it on your own.
 
Giriraj Bhojak
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you guys for prompt responses.
Apologies for not being clear earlier.
I am a newbie to web services.
To answer William's question:
The other application to which I need to send a request is not under my control.
I am going through Apache WSS4J and it mentions that it can be used in standalone manner.
The reason for using SOAP is due to the structure of request message, it's a complex message and the structure can be easily explained via xsd/xml. Same goes for the response.

To reply to Ulf's question:
Pardon me but I am not that familiar with web services, I am more than willing to use a WS f/w. I have been going through Apache CXF user guide, but I haven't been able to find a way to send a message without defining a contract first.
It seems that wsdl is required for communicating. The whole notion of endpoints seem to be tied to WSDL.
Here is what I need to do:
Create a request message using request schema(through an xml-java mapping), apply ws security around it and then send it over HTTP.
The client (most probably a servlet )is expected to perform the reverse operations on security aspects, process the message and then return a response.

I found org.apache.axis2.saaj.SOAPConnectionImpl in Axis2 distribution that can be used to for point to point communication over HTTP. But I am hesitant to use it since I would have to build a WSS4J layer around it to answer security concerns.
I am still not able to fathom the need for WSDL here, since there is not service that I need to publish. Perhaps I am missing something.
I would be very thankful for your suggestions and help. Coderanch has helped me a lot over the years to answer not so trivial questions.

Thanks,
Giriraj.

 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To answer William's question:
The other application to which I need to send a request is not under my control.


If this was my problem I would be trying to get documentation on this application. If it is a formal SOAP server it should be supplying a WSDL or some other form of expected message format documentation.

If there is no WSDL, perhaps an example of a complete request as a text file.

I once helped a client who needed to send simple update messages to an existing SOAP service. Rather than build a complete client from the wsdl I took an existing example request message and used it as a template, plugging in his changing values. Ever so much faster than building XML. Naturally this only works for a simple service without WS-* embellishments.

Bill
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Giriraj Bhojak wrote:The other application to which I need to send a request is not under my control.

It should still have a WSDL; that is the standard way to create clients for a WS. It's not even more work - once you (or someone else) create a SOAP WS, the SOAP engine will create a WSDL for you with no work required on your part.

I am still not able to fathom the need for WSDL here, since there is not service that I need to publish. Perhaps I am missing something.

A WSDL is not about publishing (that would be UDDI), it is about defining the public API of a WS. It allows you to build clients easily. Otherwise, reverse-engineering all the data types in your client code can be a decidedly nontrivial task - the tools that come with the SOAP stack do all that for you.
 
Giriraj Bhojak
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My application would govern the message format. The other application would need to adhere to the request/response format and send a response in the pre-defined format.
It's not like there is an existing schema that the other app is using and I need to stick to it.
It does not have control over the message format.
So in that case I would need to send the schema to other application(I am not sure I should call it a client, since my application would make a request to it).
I will see if it's still possible to request WSDL from the client.
But do you guys still think wsdl is the right way to go?
Thank you for clearing the notions about WSDL and UDDI.

Thanks,
Giriraj.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not like there is an existing schema that the other app is using and I need to stick to it.
It does not have control over the message format.
So in that case I would need to send the schema to other application(I am not sure I should call it a client, since my application would make a request to it).


I wonder if you understand how very very weird that sounds.

IF the "other application" is a SOAP web server THEN it has a commitment to the SOAP message format and a schema.

IF the "other application" is not a SOAP web server THEN we need to start all over again with documentation of what the "other application" actually is.

Bill

 
Giriraj Bhojak
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's not really that weird .
Indeed the other application would be a SOAP server.
I wanted to say that I would control the message format and the other app would need to adhere to it. And my confusion was around using web-services to accomplish it.
But after much discussion with you guys, I have better understanding now.
Million thanks to you guys.

Thanks,
Giriraj.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!