0

I am using Jaxws to consume a webservice. while iam sending request i need to send an object in the request headers. When i am invoking the service from Soap-UI iam successfully getting the data. but the same in java i am unable to get it. I researched a lot on this any one know please help me how to do it.

Here is my java code

//getting the service
MyService servc = new MyService();
MyServiceSoap soap = servc.getMyServiceSoap();
//call the service
System.out.println(soap.SERVICE_A("123456789")); //getting null as response because i am not setting userid, password

I want to set the userid,password to the Authentication pojo object and set it to the soap headers and send the request. how i can do this.?

Here is my Soap-ui request screenshot Please see the SoapUI request format

My Questions is : How to send a java object in the soap request headers.?

Thanks in Advance, Praneeth.

1 Answers1

1

From my understanding, what you're lacking is the Basic Authentication headers, where you pass the following in the HTTP header:

Authorization: Basic <Base64(username:password)>

Check in your SOAP-UI if the request sends this.

Here are some SO topics that may help you implement it:

  1. Java Web Service client basic authentication
  2. How do I consume a web service protected with HTTP basic authentication using the CXF framework?
Community
  • 1
  • 1
Baderous
  • 1,069
  • 1
  • 11
  • 32