users@jax-rpc.java.net

Re: DII Client for DiningGuide example using Vector for return value

From: kathy walsh <Kathleen.Walsh_at_Sun.COM>
Date: Mon, 10 May 2004 14:27:13 -0400

Sridhar-

Let me get familiar with the example a little bit and I will get back to you
shortly- Your hunch about the vector return type is most likely correct-
Kathy

Sridhar Reddy wrote:

>
> Hi,
>
> I am trying to develop a DII client to the DiningGuide example from
> the Java Studio Enterprise
> Tutorials and Code Camps:
> http://developers.sun.com/prodtech/javatools/jsenterprise/learning/tutorials/index.html
>
> I am using Studio6 with Application Server 7 update 3 with Java WSDP
> 1.3 [JAX-RPC 1.1 support]
>
> Below is the code that is new in the DIIClient shown in 3 sections:
> - imports area in CustomerReviewTable.java
> - getCustomerReviewByName method in CustomerReviewTable.java
> [Basically taking the code from
> http://java.sun.com/webservices/docs/1.0/tutorial/doc/JAXRPC6.html#75222
> and modifying this to use this service and make appropriate
> changes for the return value (Vector).
> I suspect that this is where the problem is but need help to
> fix it. - Thanks!!]
> - Variables declaration new for DIIClient
>
> - The WSDL for the DGWebService service is also shown
>
> I tried it with both JAXRPC 1.0 and JAXRPC 1.1 [Setting this for the
> Service in Studio 6] and regenerating the Service code
> but did not see any difference.
>
> Right now, with the code shown below, I do not get any exceptions, but
> it doesnot show any reviews [Vector returned is null].
>
> Really appreciate your help,
> Sridhar.
>
> ============ imports area in CustomerReviewTable.java ===============
> package DIIClient;
> import javax.swing.table.*;
> import java.util.*;
> import WebService.DGWebServiceClientGenClient.*;
>
> /* New for DII */
> import javax.xml.rpc.Call;
> import javax.xml.rpc.Service;
> import javax.xml.rpc.JAXRPCException;
> import javax.xml.namespace.QName;
> import javax.xml.rpc.ServiceFactory;
> import javax.xml.rpc.ParameterMode;
>
>
> ========= getCustomerReviewByName method in
> CustomerReviewTable.java =========
> private Vector getCustomerReviewByName(java.lang.String
> restaurantname) {
> Vector custList = new Vector();
> try {
> /* Old Static Stub in the Swing Client that works:
> WebService.DGWebServiceClientGenClient.DGWebService
> service2 = new
> WebService.DGWebServiceClientGenClient.DGWebService_Impl();
>
> WebService.DGWebServiceClientGenClient.DGWebServiceServantInterface
> port = service2.getDGWebServiceServantInterfacePort();
> custList =
> (java.util.Vector)port.getCustomerreviewsByRestaurant(restaurantname);
> */
> /* New DII Code below ... */
> System.out.println("Now using DII Code ...");
> ServiceFactory factory = ServiceFactory.newInstance();
> Service service = factory.createService(new
> QName(qnameService));
> QName port = new QName(qnamePort);
> Call call = service.createCall(port);
>
> call.setTargetEndpointAddress(endPointAddress);
> call.setProperty(Call.SOAPACTION_USE_PROPERTY, new
> Boolean(true));
> call.setProperty(Call.SOAPACTION_URI_PROPERTY, "");
> call.setProperty(ENCODING_STYLE_PROPERTY, URI_ENCODING);
> QName QNAME_TYPE_STRING = new QName(NS_XSD, "string");
> QName QNAME_TYPE_VECTOR = new QName(NS_XSD, "vector");
> call.setReturnType(QNAME_TYPE_VECTOR);
>
> call.setOperationName(new QName(BODY_NAMESPACE_VALUE,
> "getCustomerreviewsByRestaurant"));
> call.addParameter("String_1", QNAME_TYPE_STRING,
> ParameterMode.IN);
> String[] params = { restaurantname };
> custList = (java.util.Vector) call.invoke (params);
>
> System.out.println(custList); }
> catch (Exception ex) {
> System.err.println("Caught an exception." );
> ex.printStackTrace();
> }
> return custList;
> }
>
> ============ Variables declaration new for DIIClient ====================
> //Variables declaration new for DIIClient
> private static String qnameService = "DGWebService";
> private static String qnamePort = "DGWebServiceServantInterface";
> private static String endPointAddress =
> "http://localhost:80/DGWebService/DGWebService";
>
> private static String BODY_NAMESPACE_VALUE = "urn:DGWebService/wsdl";
> private static String ENCODING_STYLE_PROPERTY =
> "javax.xml.rpc.encodingstyle.namespace.uri";
> // private static String NS_XSD = "http://www.w3.org/2001/XMLSchema";
> private static String NS_XSD =
> "http://java.sun.com/jax-rpc-ri/internal";
> private static String URI_ENCODING =
> "http://schemas.xmlsoap.org/soap/encoding/";
> //http://schemas.xmlsoap.org/soap/encoding/
> //http://java.sun.com/jax-rpc-ri/internal
>
> ============ The WSDL for the DGWebService service =================
> <?xml version="1.0" encoding="UTF-8"?>
>
> <definitions name="DGWebService"
> targetNamespace="urn:DGWebService/wsdl"
> xmlns:tns="urn:DGWebService/wsdl"
> xmlns="http://schemas.xmlsoap.org/wsdl/"
> xmlns:ns2="http://java.sun.com/jax-rpc-ri/internal"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
> xmlns:ns3="urn:DGWebService/types">
> <types>
> <schema targetNamespace="http://java.sun.com/jax-rpc-ri/internal"
> xmlns:tns="http://java.sun.com/jax-rpc-ri/internal"
> xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
> <import namespace="urn:DGWebService/types"/>
> <complexType name="vector">
> <complexContent>
> <extension base="tns:list">
> <sequence/></extension></complexContent></complexType>
> <complexType name="list">
> <complexContent>
> <extension base="tns:collection">
> <sequence/></extension></complexContent></complexType>
> <complexType name="collection">
> <complexContent>
> <restriction base="soap11-enc:Array">
> <attribute ref="soap11-enc:arrayType"
> wsdl:arrayType="anyType[]"/></restriction></complexContent></complexType></schema>
>
> <schema targetNamespace="urn:DGWebService/types"
> xmlns:tns="urn:DGWebService/types"
> xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
> xmlns="http://www.w3.org/2001/XMLSchema">
> <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
> <import namespace="http://java.sun.com/jax-rpc-ri/internal"/>
> <complexType name="CustomerreviewDetail">
> <sequence>
> <element name="customername" type="string"/>
> <element name="restaurantname" type="string"/>
> <element name="review" type="string"/>
> <element name="sampleProperty"
> type="string"/></sequence></complexType>
> <complexType name="RestaurantDetail">
> <sequence>
> <element name="address" type="string"/>
> <element name="cuisine" type="string"/>
> <element name="description" type="string"/>
> <element name="neighborhood" type="string"/>
> <element name="phone" type="string"/>
> <element name="rating" type="int"/>
> <element name="restaurantname" type="string"/>
> <element name="sampleProperty"
> type="string"/></sequence></complexType></schema></types>
> <message name="DGWebServiceServantInterface_createCustomerreview">
> <part name="String_1" type="xsd:string"/>
> <part name="String_2" type="xsd:string"/>
> <part name="String_3" type="xsd:string"/></message>
> <message
> name="DGWebServiceServantInterface_createCustomerreviewResponse"/>
> <message name="DGWebServiceServantInterface_getAllRestaurants"/>
> <message name="DGWebServiceServantInterface_getAllRestaurantsResponse">
> <part name="result" type="ns2:vector"/></message>
> <message name="DGWebServiceServantInterface_getCustomerreviewDetail"/>
> <message
> name="DGWebServiceServantInterface_getCustomerreviewDetailResponse">
> <part name="result" type="ns3:CustomerreviewDetail"/></message>
> <message
> name="DGWebServiceServantInterface_getCustomerreviewsByRestaurant">
> <part name="String_1" type="xsd:string"/></message>
> <message
> name="DGWebServiceServantInterface_getCustomerreviewsByRestaurantResponse">
>
> <part name="result" type="ns2:vector"/></message>
> <message name="DGWebServiceServantInterface_getRestaurantDetail"/>
> <message
> name="DGWebServiceServantInterface_getRestaurantDetailResponse">
> <part name="result" type="ns3:RestaurantDetail"/></message>
> <portType name="DGWebServiceServantInterface">
> <operation name="createCustomerreview" parameterOrder="String_1
> String_2 String_3">
> <input
> message="tns:DGWebServiceServantInterface_createCustomerreview"/>
> <output
> message="tns:DGWebServiceServantInterface_createCustomerreviewResponse"/></operation>
>
> <operation name="getAllRestaurants">
> <input
> message="tns:DGWebServiceServantInterface_getAllRestaurants"/>
> <output
> message="tns:DGWebServiceServantInterface_getAllRestaurantsResponse"/></operation>
>
> <operation name="getCustomerreviewDetail">
> <input
> message="tns:DGWebServiceServantInterface_getCustomerreviewDetail"/>
> <output
> message="tns:DGWebServiceServantInterface_getCustomerreviewDetailResponse"/></operation>
>
> <operation name="getCustomerreviewsByRestaurant"
> parameterOrder="String_1">
> <input
> message="tns:DGWebServiceServantInterface_getCustomerreviewsByRestaurant"/>
>
> <output
> message="tns:DGWebServiceServantInterface_getCustomerreviewsByRestaurantResponse"/></operation>
>
> <operation name="getRestaurantDetail">
> <input
> message="tns:DGWebServiceServantInterface_getRestaurantDetail"/>
> <output
> message="tns:DGWebServiceServantInterface_getRestaurantDetailResponse"/></operation></portType>
>
> <binding name="DGWebServiceServantInterfaceBinding"
> type="tns:DGWebServiceServantInterface">
> <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
> style="rpc"/>
> <operation name="createCustomerreview">
> <soap:operation soapAction=""/>
> <input>
> <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> use="encoded" namespace="urn:DGWebService/wsdl"/></input>
> <output>
> <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> use="encoded" namespace="urn:DGWebService/wsdl"/></output></operation>
> <operation name="getAllRestaurants">
> <soap:operation soapAction=""/>
> <input>
> <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> use="encoded" namespace="urn:DGWebService/wsdl"/></input>
> <output>
> <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> use="encoded" namespace="urn:DGWebService/wsdl"/></output></operation>
> <operation name="getCustomerreviewDetail">
> <soap:operation soapAction=""/>
> <input>
> <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> use="encoded" namespace="urn:DGWebService/wsdl"/></input>
> <output>
> <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> use="encoded" namespace="urn:DGWebService/wsdl"/></output></operation>
> <operation name="getCustomerreviewsByRestaurant">
> <soap:operation soapAction=""/>
> <input>
> <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> use="encoded" namespace="urn:DGWebService/wsdl"/></input>
> <output>
> <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> use="encoded" namespace="urn:DGWebService/wsdl"/></output></operation>
> <operation name="getRestaurantDetail">
> <soap:operation soapAction=""/>
> <input>
> <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> use="encoded" namespace="urn:DGWebService/wsdl"/></input>
> <output>
> <soap:body
> encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
> use="encoded"
> namespace="urn:DGWebService/wsdl"/></output></operation></binding>
> <service name="DGWebService">
> <port name="DGWebServiceServantInterfacePort"
> binding="tns:DGWebServiceServantInterfaceBinding">
> <soap:address
> location="http://localhost:80/DGWebService/DGWebService"/></port></service></definitions>
>
>
>
> =================================================================
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
> For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jax-rpc.dev.java.net
For additional commands, e-mail: users-help_at_jax-rpc.dev.java.net