Lymedo
Lymedo

Reputation: 608

what data type is the java class expecting for a webservice request?

I'm using Netbeans IDE and I'm creating a webservivce client from a wsdl file.

Netbeans has created all the classes and I've inserted the webservice reference to a jsp page and Netbeans has generated the following code:

<% 
try {
com.businessobjects.DataServicesServer service = new com.businessobjects.DataServicesServer();
com.businessobjects.RealTimeServices port = service.getRealTimeServices();
 // TODO initialize WS operation arguments here
com.businessobjects.service.postcodelookup.input.PostcodeLookupRequest inputBody = null;
// TODO process result here
com.businessobjects.service.postcodelookup.output.PostcodeLookupReply result = port.postcodeLookup(inputBody);
out.println("Result = "+result);
} catch (Exception ex) {
// TODO handle custom exceptions here
}
%>

From this code I understand that I need to set a value for 'inputBody' (currently set as null by default) but I don't know what data type to use.

Here the code from PostcodeLookupReply.class

package com.businessobjects.service.postcodelookup.input;

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


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

@XmlElement(required = true)
protected String postcode;

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

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

}

The value that need to be passed to 'inputBody' will be created from a parameter value from a URL string. I just need to know what and how to convert it so that it's accepted by the class.

Any help will be appreciated.

Thanks

Upvotes: 0

Views: 189

Answers (1)

Mustafa
Mustafa

Reputation: 36

It would be a new PostcodeLookupRequest() with the setPostCode method called on that instance.

Upvotes: 1

Related Questions