Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

JAX-WS versus Axis2, WSDL Implementation

 
Greenhorn
Posts: 24
Eclipse IDE MySQL Database Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I recently started working on webservices and i am facing few problems,

but firstly i want to understand what is the difference between implementation of web service client using jax-ws and axis2.

The problem that I am facing is, I have to implement an integration with a third party with our application, and third party have shared their WSDL file with us.
I initially tried to generate the stubs using axis2 and after setting the required parameters and on calling the service the service it is giving 401 error: unauthorized.
after contacting third party team, i was told that I have to use NTLM and they shared us the credentials as well....

code from implementation is below:
WSStub stub = new WSStub();
SoapOp soapOp0 = new SoapOp();

soapOp0.setPPacketsIn("param");

// NTLM
HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
auth.setUsername("username");
auth.setPassword("password");

auth.setHost("abc.xyz.com");
auth.setDomain("DOMAIN");

auth.setPreemptiveAuthentication(true);
List authSchemes = new ArrayList();
authSchemes.add(AuthPolicy.NTLM);
auth.setAuthSchemes(authSchemes);

final ServiceClient client = stub._getServiceClient();
Options options = client.getOptions();
options.setProperty(HTTPConstants.AUTHENTICATE, auth);
options.setProperty(HTTPConstants.CHUNKED, "false");


stub._getServiceClient().setOptions(options);
response = payWSStub.soapOp(soapOp0);

above code is still giving the same error: 401 unauthorized, and as per third party I have not used NTLM to pass the credentials, which i assume I have done it correctly
When I looked at their implementation of WSDL, they have used JAX-WS for generating stubs.


Please help and tell me does it makes a difference if I use to generate stubs using AXIS2 instead of JAX-WS.

any help would be greatly appreciated.

many thanks,
shiv

 
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just a JDBC provider concept, you have many provider or implementation from DB2, ORACLE, MYSQL.
JAX-WS is a specification, you many provider or implementation from JAX-WS RI called Metro, Apache CXF, AXIS2 etc..
The question now is which implementation has all the features mentioned in the JAX-WS spec.

For better explanation , a must read link https://coderanch.com/how-to/java/WebServicesFaq

If you choose AXIS2, then GOOGLE or see AXIS2 doc how to a code sample how to pass NTLM authentication to your web service provider.
or if you choose any other implementation Metro, Apache CXF, then do the same.
 
Here. Have a potato. I grew it in my armpit. And from my other armpit, this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic