0
votes

In my project, we consume webservices . What was confusing to me was there were some webservices(say A) that were called just using the HttpURLConnection and req/response was marshalled/unmarshalled using JAXB

There is another web service(say B) for which i see many classes with JAX WSRI and its not called using HttpURLConnection. I also see .wsdl files for these webservices.

/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.1.1 in JDK 6
* Generated source version: 2.0
* 
*/

@WebService(name = "ABPortType",     targetNamespace        "http://www.ups.com/WSDL/XOLTWS/DCR/v1.0")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface ABCPortType {
@WebMethod(operationName = "ProcessAB", action  =      =   "http://example.com/webservices/xxBinding/v1.0")
@WebResult(name = "xxResponse", targetNamespace =    "http://xx.com/XMLSchema/XXWS/AB/v1.0", partName = "Body")

}

MY doubts are

  1. Why are we calling the webservice B with all these extra bloat (end point, JAX WS RI instead of using HttpURLConnection?

  2. can HttpULConnection be used to call this webservice B

  3. For webservice A that is called using HttpURLConnection there is no WSDL (just jaxb classes created from xsd) but whreas the WS that is called using JAXWS RI generated classes has a WSDL. Are the web service A and B implemnted differentely and thats why we call them in different ways

Please help me understand

-Venkat

1

1 Answers

0
votes

According to the order of your questions:

  1. If you are using JAX-WS API, may be you want to generate client proxy classes from the WebService, e.g. using the wsimport tool for generate the client stubs from the WSDL document file. So that you work with Java objects and not with XML. Only in special cases, you need a XML handler for advanced features, such as WS-Security.

  2. Yes. You need to work with the XML directly and use JAX-B for marshall/unmarshall the messages.

  3. The WSDL document file describes the SOAP service and the signatures of all the operations available in the service. If A does not have a descriptor (the WSDL document file), may not use the JAX-WS API, e.g. Java WSDP, or the service provider is not exposing the WSDL.