users@jax-rpc.java.net

JAX-RPC DII Client

From: gaje gaj <gaje85_at_yahoo.com>
Date: Wed, 3 Mar 2004 02:50:44 -0800 (PST)

Hi ,

 I am writing a DII client for a web service .
 I used the stub client approach It worked.
 I changed the source code of the StreamingSender.java
file to print the generated SOAP Message.

 For a static client (using stub) the SOAP Message
Generated is

 <?xml version="1.0" encoding="UTF-8" ?>
 <env:Envelope
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns0="urn:sap-com:document:sap:rfc:functions">
 <env:Body>
 <ns0:Z_WARRANTY_LOOKUP>
  <CUSTOMER_NUM>123</CUSTOMER_NUM>
  <PRODUCT_ALIAS>123</PRODUCT_ALIAS>
  <PRODUCT_NUM>122</PRODUCT_NUM>
  <SALES_ORDER>12232</SALES_ORDER>
  <SERIAL_NUM>121212121</SERIAL_NUM>
  </ns0:Z_WARRANTY_LOOKUP>
  </env:Body>
  </env:Envelope>

For the Dynamic Client (DII) the SOAP Message
generated is

<?xml version="1.0" encoding="UTF-8"?><env:Envelope
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><env:Body><ans1:Z_WARRANTY_LOOKUP
xmlns:ans1="urn:sap-com:document:sap:rfc:functions"><CUSTOMER_NUM
href="#ID1"/><PRODUCT_ALIAS href="#ID2"/><PRODUCT_NUM
href="#ID3"/><SALES_ORDER href="#ID4"/><SERIAL_NUM
href="#ID5"/></ans1:Z_WARRANTY_LOOKUP><ans1:CUSTOMER_NUM
xmlns:ans1="urn:sap-com:document:sap:rfc:functions"
id="ID1"/><ans1:PRODUCT_ALIAS
xmlns:ans1="urn:sap-com:document:sap:rfc:functions"
id="ID2"/><ans1:PRODUCT_NUM
xmlns:ans1="urn:sap-com:document:sap:rfc:functions"
id="ID3"/><ans1:SALES_ORDER
xmlns:ans1="urn:sap-com:document:sap:rfc:functions"
id="ID4"/><ans1:SERIAL_NUM
xmlns:ans1="urn:sap-com:document:sap:rfc:functions"
id="ID5"/></env:Body></env:Envelope>

if you see the dynamic client SOAP Message there is
not input values which I passed in the program .


My DII Client program program is as follows:

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 HelloClient {

    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) {

        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("url");

           
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,
URI_ENCODING);
            
            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();
        }
    }
}

The p[] which I am passing in the invoke is not
populating in the SOAP Message .
Can anybody help me ?

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