Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SOAP header in SOAP request

 
Rajesh Balu
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


How to add the soap header in the SOAP request?

I want to add the headers not through coding. I want to add it manually.

I can able to add the headers through SOAPUI. But i need to add in request.
 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand what you're trying to do. SOAP is something that is generally created dynamically at runtime via a library, not manually or statically. What do you hope to achieve by creating SOAP statically? Can you post an example of the SOAP you have, the SOAP you'd like to have, and explain the use case?
 
Rajesh Balu
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the sample request.

Header.jpg
[Thumbnail for Header.jpg]
 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you do not actually want to add that header manually, you want to add it programmatically at runtime? How are you creating the SOAP call, meaning - which API are you using?
 
Rajesh Balu
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I do not want to add it programmatically at run time.

I want to add it along with the existing SOAP header.
 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I don't get it. You don't want to add it manually, and you don't want to add it programmatically. When, and how, do you want to add it? It seems that your problem is rather unusual, so you need to tell us more about it.
 
Rajesh Balu
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my scenario.

I have an XML which is generated from an application.

I need to transform it to SOAP request through transformation.

I have created a transformation by adding the SOAP tags as text.

Now i am experiencing the SOAP header issue which i need to add along with the request.

I cannot use any coding stuff here.

Hpoe this is much clear now. Please let me know if you need more details.
 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, it's not any clearer. You're asking about an XML/SOAP file that you have locally on your machine? What, exactly, do you mean by "transformation"? If you can add SOAP tags, why can't you add SOAP headers?
 
Rajesh Balu
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Transformation is a processing of converting XML to SOAP request. I am not familiar about the SOAP header format.

Please let me know the header format, so that i can add it in the transformation.
 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SOAP is a very simple format; I suggest you read its specification, then it should become clear. I also don't want to send you down some wrong avenue, as I don't understand what you're trying to do, and why.
 
Rajesh Balu
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


Still i am not getting any clear idea. Could someone please help me to add additional HTTP headers to SOAP message?


Thanks,
Rajesh.B
 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think anyone will be able to help you unless and until you answer these questions:
Tim Moores wrote:Sorry, it's not any clearer. You're asking about an XML/SOAP file that you have locally on your machine? What, exactly, do you mean by "transformation"? If you can add SOAP tags, why can't you add SOAP headers?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using an existing SOAP toolkit such as AXIS2 or are you using standard Java to manage sending the request?

In one place you say SOAP header and in another HTTP headers - not the same. SOAP headers are part of the HTTP request body sent to the SOAP server. Which is it?

Bill
 
Rajesh Balu
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I am using SoapUI to sending the request. I don't want to use any java code here.

Sorry, It's Soap additional HTTP header. I need to add it along with the SOAP request.
 
Tim Moores
Bartender
Posts: 2895
46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rajesh Balu wrote:It's Soap additional HTTP header.

As was mentioned before, SOAP headers are not HTTP headers. So which one is it?
 
Rajesh Balu
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

For an example: i would like to add HTTP header like Content-Type HTTP header in SOAP request.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, if SOAPui doesn't provide for that you will need to write your own code to send the request, right?

It is pretty straightforward, the java standard library has all you need to make a HTTPUrlConnection and send a request with the body being your SOAP message.

Bill
 
Rajesh Balu
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Actually i am in a scenario of not using any coding stuffs. So i need to add it without any coding stuffs.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to this SOAPui documentation it is possible to create custom HTTP headers.

I found that in about 2 seconds googling for "soapui http header"

Why are you bothering us when SOAPui has a documented way to do what you want? RTFM
 
Rajesh Balu
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


Thanks for all your prompt response.

yes there is an option to add the custom HTTP headers in SoapUI. But i need to add the same in the request itself instead of adding it through some options.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic