users@jax-rpc.java.net

Re: JAX-RPC DII Client

From: kathy walsh <Kathleen.Walsh_at_Sun.COM>
Date: Sat, 06 Mar 2004 08:05:16 -0500

gaje,

My first question is why are you using dii? Dii is meant for very simple
types only and not
more complex types.

Given that you must use dii, I encourage you to read the java web
services tutorial that
can be downloaded at java.sun.com. The tutorial has some very good
advanced examples
using dii with document/literal services.

A quick look at your client code and your wsdl tells me that you are
setting the wrong type(s)
as your parameters - you should be setting one parameter only- the
element 'Z_WARRANTY_LOOKUP'
that is a complex type. You will need to generate a java class for this
element before compiling your
dii client program -

If you read the tutorial under the jaxrpc/advanced examples, the steps
will be outlined for you-

Please give it a look and I will answer any questions that you may have-

Regards,
Kathy

gaje gaj wrote:

>Hi ,
>
> As per your suggestion I modified my DII Client
>program .
>
> I got a StackTrace like this
>
>[failed to localize]
>dii.parameter.type.ambiguous.no.class(0,
>{urn:sap-com:docum
>ent:sap:rfc:functions}ZWARRANTY_ENTITLE,
>{urn:sap-com:document:sap:rfc:functions
>}ZWARRANTY_ENTITLE)
> at
>com.sun.xml.rpc.client.dii.BasicCall.serializerNotFoundException(Basi
>cCall.java:810)
> at
>com.sun.xml.rpc.client.dii.BasicCall.createLiteralResponseSerializer(
>BasicCall.java:744)
> at
>com.sun.xml.rpc.client.dii.BasicCall.getResponseDeserializer(BasicCal
>l.java:708)
> at
>com.sun.xml.rpc.client.dii.BasicCall.invoke(BasicCall.java:470)
> at HelloClient3.main(HelloClient3.java:84)
>
>
>My DII Client program looks like this
>
>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;
>import javax.xml.rpc.handler.*;
>import javax.xml.rpc.handler.soap.*;
>import javax.xml.soap.*;
>import java.util.*;
>
>public class HelloClient3 {
>
> private static String qnameService =
>"Z_WARRANTY_LOOKUPService";
> private static String qnamePort =
>"Z_WARRANTY_LOOKUPPortType";
>
> private static String BODY_NAMESPACE_VALUE =
>"urn:sap-com:document:sap:rfc:functions";
> 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 URI_ENCODING =
>"http://schemas.xmlsoap.org/soap/encoding/";
>
>
> public static void main(String[] args) {
>
> String s1="123";
> String s2="1233";
> String s3="1234";
> String s4="123rr";
> String s5="123tt";
> try {
> ServiceFactory factory =
>ServiceFactory.newInstance();
> QName serviceName = new
>QName(BODY_NAMESPACE_VALUE, "LogHandler");
> QName portName = new QName(BODY_NAMESPACE_VALUE,
>"LogHandlerPort");
> List handlerChain = new ArrayList();
> Map logConfig = new HashMap();
> logConfig.put("logDirectory", "d:/ temp");
> logConfig.put("severityLevel", "verbose");
> handlerChain.add(new HandlerInfo(LogHandler.class,
>logConfig, null));
> Service service =
>factory.createService(serviceName);
> HandlerRegistry registry =
>service.getHandlerRegistry();
> registry.setHandlerChain(portName, handlerChain);
>
>
> QName port = new QName(qnamePort);
>
> Call call = service.createCall(port);
>
>call.setTargetEndpointAddress("http://dvl.sapnet.hp.com/sap/bc/soap/rfc");
>
>
>call.setProperty(Call.SOAPACTION_USE_PROPERTY, new
>Boolean(true));
>
>call.setProperty(Call.SOAPACTION_URI_PROPERTY,"");
>
>call.setProperty(Call.USERNAME_PROPERTY,"SWOPRFC");
> call.setProperty(Call.PASSWORD_PROPERTY
>,"3A3RHX6H");
>
>call.setProperty(ENCODING_STYLE_PROPERTY,"");
>
>call.setProperty(Call.OPERATION_STYLE_PROPERTY,
>"document");
>
> call.addParameter("CUSTOMER_NUM", new
>javax.xml.namespace.QName("urn:sap-com:document:sap:rfc:functions","CUSTOMER_NUM"),String.class,javax.xml.rpc.ParameterMode.IN);
> call.addParameter("PRODUCT_ALIAS", new
>javax.xml.namespace.QName("urn:sap-com:document:sap:rfc:functions","PRODUCT_ALIAS"),String.class,javax.xml.rpc.ParameterMode.IN);
> call.addParameter("PRODUCT_NUM", new
>javax.xml.namespace.QName("urn:sap-com:document:sap:rfc:functions","PRODUCT_NUM"),String.class,javax.xml.rpc.ParameterMode.IN);
> call.addParameter("SALES_ORDER", new
>javax.xml.namespace.QName("urn:sap-com:document:sap:rfc:functions","SALES_ORDER"),String.class,javax.xml.rpc.ParameterMode.IN);
> call.addParameter("SERIAL_NUM", new
>javax.xml.namespace.QName("urn:sap-com:document:sap:rfc:functions","SERIAL_NUM"),String.class,javax.xml.rpc.ParameterMode.IN);
> call.setReturnType(new
>javax.xml.namespace.QName("urn:sap-com:document:sap:rfc:functions","ZWARRANTY_ENTITLE"));
> call.setOperationName(new
>QName(BODY_NAMESPACE_VALUE,"Z_WARRANTY_LOOKUP"));
>
> System.out.println(call);
> Object p[] = {s1,s2,s3,s4,s5};
>
> Object result = call.invoke(p);
> System.out.println(result);
>
> } catch (Exception ex) {
> ex.printStackTrace();
> }
> }
>}
>
>In my previous mail I attached my WSDL .
>
>Thanks & Regards
>Gajendran.G
>
>
>
>__________________________________
>Do you Yahoo!?
>Yahoo! Search - Find what you’re looking for faster
>http://search.yahoo.com
>
>---------------------------------------------------------------------
>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