Monday, December 19, 2011

SOAP Client

Up to this point, REST and SOAP seemed similar.  But to understand the client differences, we should take a look at the request, response activity from the services.

From the: create Method invocation:

SOAP Request

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Header/>
    <S:Body>
        <ns2:create xmlns:ns2="http://service.sample.com/">
            <name>A New Part</name>
            <parentName>Tower</parentName>
        </ns2:create>
    </S:Body>
</S:Envelope>

SOAP Response


<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
    <S:Body>
        <ns2:createResponse xmlns:ns2="http://service.sample.com/">
            <return>
                <id>72</id>
                <name>A New Part</name>
                <parent>Tower</parent>
            </return>
        </ns2:createResponse>
    </S:Body>
</S:Envelope>
Compare that to what we saw with the REST Client in Testing and Using the REST Client/Service.

Now with the REST client, we used jersey (JAX-RS Reference Implementation) to handle all the parsing for us.  With the SOAP client, we see that each request/response is defined by the WSDL, not a POJO.  I used Netbeans to automatically generate the base code.  It generated 11 source files.  For each of the three methods, there was a file to generate the request, and a file to generate the response.  Then there was a configuration file, an interface class for the service, a service class, an object factory, and a Part.java file that was responsible for generating the XML related to the Part.  Seriously more complex then the simple PartEntityRESTClient class, and the @XmlRootElement annotation in Part.java.  Even comparing the request/response xml files above to the request/response for the REST client, we see the complexity taking shape.  Again, there are tools that will create a POJO for you to hide service implementation, i.e. Apache Axis / WSDL2JAVA.  But, this only masks the complexity.  BUT, the source files were automatically generated, so does it really matter if there were 2 or 100?

I will post the generated sources at the end of this posting, but since they are auto generated, I wont review them.

So, how do we use the client?  Well, with the REST client, we created a RestBean for interaction with the JSF client.  To use the SOAP client, we will create a SOAPClientBean.java:

package com.sample.service.client;
import java.awt.event.ActionEvent;
import java.io.Serializable;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
/**
 * JSF Named bean for interacting with a SOAP web and performing CRUD operations on the Parts table
 * Request Scope
 * @author Thomas Dias
 */
@Named(value = "soapBean")
@RequestScoped
public class SOAPClientBean implements Serializable {
    private String name = "", parentName = "", msg = "";
      /** Default constructor */
    public SOAPClientBean() {
    }
    /**
     * Action method to create a part
     * @return empty string
     */
    public String create() {
        SOAPDemoWebService service = new SOAPDemoWebService_Service().getSOAPDemoWebServicePort();
        Part response = service.create(name, parentName);
        name = response.getName();
        parentName = response.getParent();
        msg = "Created " + response.getId() + " " + response.getName();
        return "";
    }
    /**
     * Listener method to create a part
     * @param event
     */
    public void create(ActionEvent event) {
        create();
    }
    /**
     * Listener method for deleting a part
     * @param event
     */
    public void delete(ActionEvent event) {
        delete();
    }
    /**
     * Action method for deleting a part
     * @return empty string
     */
    public String delete() {
        SOAPDemoWebService service = new SOAPDemoWebService_Service().getSOAPDemoWebServicePort();
        Part response = service.find(name);
      
        if (response.getId() == 0l) {
            msg = "No Part Found";
        } else {
            service.remove(response.id);
            msg = "Deleted " + name + " : " + response.id;
        }
        return "";
    }
    /**
     * Listener method for retrieving a part whose name is name
     * @param event
     */
    public void find(ActionEvent event) {
        find();
    }
    /**
     * Action method for retrieving a part whose name is name
     * @return empty string
     */
    public String find() {
        SOAPDemoWebService service = new SOAPDemoWebService_Service().getSOAPDemoWebServicePort();
        Part response = service.find(name);
        name = response.getName();
        parentName = response.getParent();
        msg = "Found: " + response.getId() + ", " + response.getName();
        return "";
    }
    // *** Standard getters and setters below this line
    public String getMsg() {
        return msg;
    }
    public void setMsg(String msg) {
        this.msg = msg;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getParentName() {
        return parentName;
    }
    public void setParentName(String parentName) {
        this.parentName = parentName;
    }
}


We instantiated our client by :
        SOAPDemoWebService service = new SOAPDemoWebService_Service().getSOAPDemoWebServicePort();
We were then able to call the methods we had defined in our service. i.e. 
        Part response = service.create(name, parentName); 
Calls the service create method, passing in the two parameters we had defined, and it returns a "Part".  Note also: this is not the same Part.class that we had defined for our REST service, although it does the same thing.

And we see that using the client, was no more complicated then using the REST client.  Note: we also used NetBeans to generate most of the REST client.  Now, when reviewing the fact that the SOAP client generated a whole host of files to handle the SOAP service, we realize that the REST client is also using Jersey to handle its translation from and to XML such that the comparison of complexity really seems to be a wash.  To be clear: I am not suggesting one or the other, I just think the ease of use issue has been over hyped.  The SOAP model is much more complex, but the complexity has, for the most part been hidden.

Below are the autogenerated source files.

Create.java

package com.sample.service.client;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for create complex type.
 *
 * <p>The following schema fragment specifies the expected content contained within this class.
 *
 * <pre>
 * &lt;complexType name="create">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="parentName" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "create", propOrder = {
    "name",
    "parentName"
})
public class Create {

    protected String name;
    protected String parentName;

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *    
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *    
     */
    public void setName(String value) {
        this.name = value;
    }

    /**
     * Gets the value of the parentName property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *    
     */
    public String getParentName() {
        return parentName;
    }

    /**
     * Sets the value of the parentName property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *    
     */
    public void setParentName(String value) {
        this.parentName = value;
    }

}


CreateResponse.java

package com.sample.service.client;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for createResponse complex type.
 *
 * <p>The following schema fragment specifies the expected content contained within this class.
 *
 * <pre>
 * &lt;complexType name="createResponse">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="return" type="{http://service.sample.com/}part" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "createResponse", propOrder = {
    "_return"
})
public class CreateResponse {

    @XmlElement(name = "return")
    protected Part _return;

    /**
     * Gets the value of the return property.
     *
     * @return
     *     possible object is
     *     {@link Part }
     *    
     */
    public Part getReturn() {
        return _return;
    }

    /**
     * Sets the value of the return property.
     *
     * @param value
     *     allowed object is
     *     {@link Part }
     *    
     */
    public void setReturn(Part value) {
        this._return = value;
    }

}



Find.java

package com.sample.service.client;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for find complex type.
 *
 * <p>The following schema fragment specifies the expected content contained within this class.
 *
 * <pre>
 * &lt;complexType name="find">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "find", propOrder = {
    "name"
})
public class Find {

    protected String name;

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *    
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *    
     */
    public void setName(String value) {
        this.name = value;
    }

}






FindResponse.java

package com.sample.service.client;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for findResponse complex type.
 *
 * <p>The following schema fragment specifies the expected content contained within this class.
 *
 * <pre>
 * &lt;complexType name="findResponse">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="return" type="{http://service.sample.com/}part" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "findResponse", propOrder = {
    "_return"
})
public class FindResponse {

    @XmlElement(name = "return")
    protected Part _return;

    /**
     * Gets the value of the return property.
     *
     * @return
     *     possible object is
     *     {@link Part }
     *    
     */
    public Part getReturn() {
        return _return;
    }

    /**
     * Sets the value of the return property.
     *
     * @param value
     *     allowed object is
     *     {@link Part }
     *    
     */
    public void setReturn(Part value) {
        this._return = value;
    }

}



ObjectFactory.java

package com.sample.service.client;

import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlElementDecl;
import javax.xml.bind.annotation.XmlRegistry;
import javax.xml.namespace.QName;


/**
 * This object contains factory methods for each
 * Java content interface and Java element interface
 * generated in the com.sample.service.client package.
 * <p>An ObjectFactory allows you to programatically
 * construct new instances of the Java representation
 * for XML content. The Java representation of XML
 * content can consist of schema derived interfaces
 * and classes representing the binding of schema
 * type definitions, element declarations and model
 * groups.  Factory methods for each of these are
 * provided in this class.
 *
 */
@XmlRegistry
public class ObjectFactory {

    private final static QName _CreateResponse_QNAME = new QName("http://service.sample.com/", "createResponse");
    private final static QName _FindResponse_QNAME = new QName("http://service.sample.com/", "findResponse");
    private final static QName _Find_QNAME = new QName("http://service.sample.com/", "find");
    private final static QName _Create_QNAME = new QName("http://service.sample.com/", "create");
    private final static QName _Part_QNAME = new QName("http://service.sample.com/", "part");
    private final static QName _RemoveResponse_QNAME = new QName("http://service.sample.com/", "removeResponse");
    private final static QName _Remove_QNAME = new QName("http://service.sample.com/", "remove");

    /**
     * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.sample.service.client
     *
     */
    public ObjectFactory() {
    }

    /**
     * Create an instance of {@link Remove }
     *
     */
    public Remove createRemove() {
        return new Remove();
    }

    /**
     * Create an instance of {@link RemoveResponse }
     *
     */
    public RemoveResponse createRemoveResponse() {
        return new RemoveResponse();
    }

    /**
     * Create an instance of {@link FindResponse }
     *
     */
    public FindResponse createFindResponse() {
        return new FindResponse();
    }

    /**
     * Create an instance of {@link CreateResponse }
     *
     */
    public CreateResponse createCreateResponse() {
        return new CreateResponse();
    }

    /**
     * Create an instance of {@link Part }
     *
     */
    public Part createPart() {
        return new Part();
    }

    /**
     * Create an instance of {@link Create }
     *
     */
    public Create createCreate() {
        return new Create();
    }

    /**
     * Create an instance of {@link Find }
     *
     */
    public Find createFind() {
        return new Find();
    }

    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link CreateResponse }{@code >}}
     *
     */
    @XmlElementDecl(namespace = "http://service.sample.com/", name = "createResponse")
    public JAXBElement<CreateResponse> createCreateResponse(CreateResponse value) {
        return new JAXBElement<CreateResponse>(_CreateResponse_QNAME, CreateResponse.class, null, value);
    }

    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link FindResponse }{@code >}}
     *
     */
    @XmlElementDecl(namespace = "http://service.sample.com/", name = "findResponse")
    public JAXBElement<FindResponse> createFindResponse(FindResponse value) {
        return new JAXBElement<FindResponse>(_FindResponse_QNAME, FindResponse.class, null, value);
    }

    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link Find }{@code >}}
     *
     */
    @XmlElementDecl(namespace = "http://service.sample.com/", name = "find")
    public JAXBElement<Find> createFind(Find value) {
        return new JAXBElement<Find>(_Find_QNAME, Find.class, null, value);
    }

    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link Create }{@code >}}
     *
     */
    @XmlElementDecl(namespace = "http://service.sample.com/", name = "create")
    public JAXBElement<Create> createCreate(Create value) {
        return new JAXBElement<Create>(_Create_QNAME, Create.class, null, value);
    }

    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link Part }{@code >}}
     *
     */
    @XmlElementDecl(namespace = "http://service.sample.com/", name = "part")
    public JAXBElement<Part> createPart(Part value) {
        return new JAXBElement<Part>(_Part_QNAME, Part.class, null, value);
    }

    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link RemoveResponse }{@code >}}
     *
     */
    @XmlElementDecl(namespace = "http://service.sample.com/", name = "removeResponse")
    public JAXBElement<RemoveResponse> createRemoveResponse(RemoveResponse value) {
        return new JAXBElement<RemoveResponse>(_RemoveResponse_QNAME, RemoveResponse.class, null, value);
    }

    /**
     * Create an instance of {@link JAXBElement }{@code <}{@link Remove }{@code >}}
     *
     */
    @XmlElementDecl(namespace = "http://service.sample.com/", name = "remove")
    public JAXBElement<Remove> createRemove(Remove value) {
        return new JAXBElement<Remove>(_Remove_QNAME, Remove.class, null, value);
    }

}



Part.java

package com.sample.service.client;

import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for part complex type.
 *
 * <p>The following schema fragment specifies the expected content contained within this class.
 *
 * <pre>
 * &lt;complexType name="part">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
 *         &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="parent" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
 *         &lt;element name="subParts" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "part", propOrder = {
    "id",
    "name",
    "parent",
    "subParts"
})
public class Part {

    protected Long id;
    protected String name;
    protected String parent;
    @XmlElement(nillable = true)
    protected List<String> subParts;

    /**
     * Gets the value of the id property.
     *
     * @return
     *     possible object is
     *     {@link Long }
     *    
     */
    public Long getId() {
        return id;
    }

    /**
     * Sets the value of the id property.
     *
     * @param value
     *     allowed object is
     *     {@link Long }
     *    
     */
    public void setId(Long value) {
        this.id = value;
    }

    /**
     * Gets the value of the name property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *    
     */
    public String getName() {
        return name;
    }

    /**
     * Sets the value of the name property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *    
     */
    public void setName(String value) {
        this.name = value;
    }

    /**
     * Gets the value of the parent property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *    
     */
    public String getParent() {
        return parent;
    }

    /**
     * Sets the value of the parent property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *    
     */
    public void setParent(String value) {
        this.parent = value;
    }

    /**
     * Gets the value of the subParts property.
     *
     * <p>
     * This accessor method returns a reference to the live list,
     * not a snapshot. Therefore any modification you make to the
     * returned list will be present inside the JAXB object.
     * This is why there is not a <CODE>set</CODE> method for the subParts property.
     *
     * <p>
     * For example, to add a new item, do as follows:
     * <pre>
     *    getSubParts().add(newItem);
     * </pre>
     *
     *
     * <p>
     * Objects of the following type(s) are allowed in the list
     * {@link String }
     *
     *
     */
    public List<String> getSubParts() {
        if (subParts == null) {
            subParts = new ArrayList<String>();
        }
        return this.subParts;
    }

}



Remove.java

package com.sample.service.client;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for remove complex type.
 *
 * <p>The following schema fragment specifies the expected content contained within this class.
 *
 * <pre>
 * &lt;complexType name="remove">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="id" type="{http://www.w3.org/2001/XMLSchema}long" minOccurs="0"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "remove", propOrder = {
    "id"
})
public class Remove {

    protected Long id;

    /**
     * Gets the value of the id property.
     *
     * @return
     *     possible object is
     *     {@link Long }
     *    
     */
    public Long getId() {
        return id;
    }

    /**
     * Sets the value of the id property.
     *
     * @param value
     *     allowed object is
     *     {@link Long }
     *    
     */
    public void setId(Long value) {
        this.id = value;
    }

}



RemoveResponse.java

package com.sample.service.client;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for removeResponse complex type.
 *
 * <p>The following schema fragment specifies the expected content contained within this class.
 *
 * <pre>
 * &lt;complexType name="removeResponse">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="return" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "removeResponse", propOrder = {
    "_return"
})
public class RemoveResponse {

    @XmlElement(name = "return")
    protected boolean _return;

    /**
     * Gets the value of the return property.
     *
     */
    public boolean isReturn() {
        return _return;
    }

    /**
     * Sets the value of the return property.
     *
     */
    public void setReturn(boolean value) {
        this._return = value;
    }

}



SOAPDemoWebService.java

package com.sample.service.client;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.Action;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;


/**
 * This class was generated by the JAX-WS RI.
 * JAX-WS RI 2.2.5-b04
 * Generated source version: 2.2
 *
 */
@WebService(name = "SOAPDemoWebService", targetNamespace = "http://service.sample.com/")
@XmlSeeAlso({
    ObjectFactory.class
})
public interface SOAPDemoWebService {


    /**
     *
     * @param name
     * @return
     *     returns com.sample.service.client.Part
     */
    @WebMethod
    @WebResult(targetNamespace = "")
    @RequestWrapper(localName = "find", targetNamespace = "http://service.sample.com/", className = "com.sample.service.client.Find")
    @ResponseWrapper(localName = "findResponse", targetNamespace = "http://service.sample.com/", className = "com.sample.service.client.FindResponse")
    @Action(input = "http://service.sample.com/SOAPDemoWebService/findRequest", output = "http://service.sample.com/SOAPDemoWebService/findResponse")
    public Part find(
        @WebParam(name = "name", targetNamespace = "")
        String name);

    /**
     *
     * @param id
     * @return
     *     returns boolean
     */
    @WebMethod
    @WebResult(targetNamespace = "")
    @RequestWrapper(localName = "remove", targetNamespace = "http://service.sample.com/", className = "com.sample.service.client.Remove")
    @ResponseWrapper(localName = "removeResponse", targetNamespace = "http://service.sample.com/", className = "com.sample.service.client.RemoveResponse")
    @Action(input = "http://service.sample.com/SOAPDemoWebService/removeRequest", output = "http://service.sample.com/SOAPDemoWebService/removeResponse")
    public boolean remove(
        @WebParam(name = "id", targetNamespace = "")
        Long id);

    /**
     *
     * @param name
     * @param parentName
     * @return
     *     returns com.sample.service.client.Part
     */
    @WebMethod
    @WebResult(targetNamespace = "")
    @RequestWrapper(localName = "create", targetNamespace = "http://service.sample.com/", className = "com.sample.service.client.Create")
    @ResponseWrapper(localName = "createResponse", targetNamespace = "http://service.sample.com/", className = "com.sample.service.client.CreateResponse")
    @Action(input = "http://service.sample.com/SOAPDemoWebService/createRequest", output = "http://service.sample.com/SOAPDemoWebService/createResponse")
    public Part create(
        @WebParam(name = "name", targetNamespace = "")
        String name,
        @WebParam(name = "parentName", targetNamespace = "")
        String parentName);

}



SOAPDemoWebService_Service.java

package com.sample.service.client;

import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceException;
import javax.xml.ws.WebServiceFeature;


/**
 * This class was generated by the JAX-WS RI.
 * JAX-WS RI 2.2.5-b04
 * Generated source version: 2.2
 *
 */
@WebServiceClient(name = "SOAPDemoWebService", targetNamespace = "http://service.sample.com/", wsdlLocation = "http://localhost:8080/SOAPDemoWebService/SOAPDemoWebService?wsdl")
public class SOAPDemoWebService_Service
    extends Service
{

    private final static URL SOAPDEMOWEBSERVICE_WSDL_LOCATION;
    private final static WebServiceException SOAPDEMOWEBSERVICE_EXCEPTION;
    private final static QName SOAPDEMOWEBSERVICE_QNAME = new QName("http://service.sample.com/", "SOAPDemoWebService");

    static {
        URL url = null;
        WebServiceException e = null;
        try {
            url = new URL("http://localhost:8080/SOAPDemoWebService/SOAPDemoWebService?wsdl");
        } catch (MalformedURLException ex) {
            e = new WebServiceException(ex);
        }
        SOAPDEMOWEBSERVICE_WSDL_LOCATION = url;
        SOAPDEMOWEBSERVICE_EXCEPTION = e;
    }

    public SOAPDemoWebService_Service() {
        super(__getWsdlLocation(), SOAPDEMOWEBSERVICE_QNAME);
    }

    public SOAPDemoWebService_Service(WebServiceFeature... features) {
        super(__getWsdlLocation(), SOAPDEMOWEBSERVICE_QNAME, features);
    }

    public SOAPDemoWebService_Service(URL wsdlLocation) {
        super(wsdlLocation, SOAPDEMOWEBSERVICE_QNAME);
    }

    public SOAPDemoWebService_Service(URL wsdlLocation, WebServiceFeature... features) {
        super(wsdlLocation, SOAPDEMOWEBSERVICE_QNAME, features);
    }

    public SOAPDemoWebService_Service(URL wsdlLocation, QName serviceName) {
        super(wsdlLocation, serviceName);
    }

    public SOAPDemoWebService_Service(URL wsdlLocation, QName serviceName, WebServiceFeature... features) {
        super(wsdlLocation, serviceName, features);
    }

    /**
     *
     * @return
     *     returns SOAPDemoWebService
     */
    @WebEndpoint(name = "SOAPDemoWebServicePort")
    public SOAPDemoWebService getSOAPDemoWebServicePort() {
        return super.getPort(new QName("http://service.sample.com/", "SOAPDemoWebServicePort"), SOAPDemoWebService.class);
    }

    /**
     *
     * @param features
     *     A list of {@link javax.xml.ws.WebServiceFeature} to configure on the proxy.  Supported features not in the <code>features</code> parameter will have their default values.
     * @return
     *     returns SOAPDemoWebService
     */
    @WebEndpoint(name = "SOAPDemoWebServicePort")
    public SOAPDemoWebService getSOAPDemoWebServicePort(WebServiceFeature... features) {
        return super.getPort(new QName("http://service.sample.com/", "SOAPDemoWebServicePort"), SOAPDemoWebService.class, features);
    }

    private static URL __getWsdlLocation() {
        if (SOAPDEMOWEBSERVICE_EXCEPTION!= null) {
            throw SOAPDEMOWEBSERVICE_EXCEPTION;
        }
        return SOAPDEMOWEBSERVICE_WSDL_LOCATION;
    }

}



package-info.java

@javax.xml.bind.annotation.XmlSchema(namespace = "http://service.sample.com/")
package com.sample.service.client;


No comments:

Post a Comment