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 Answer 1

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?
Sign up to request clarification or add additional context in comments.

1 Comment

No Baderous It is not working. Thanks for your attempt. Still strugguling how i can do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.