dev@jax-rpc.java.net

Issue with Dynamic invocation of Webservices JAX RPC

From: Vijay Kumar M <vijaykumarm_at_gmail.com>
Date: Fri, 25 Apr 2008 16:28:05 -0700

Hi,
   Am using JAX RPC for webserices client implementation.
Here is my WSDL content which is deployed on SAP system:

**<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1>
   xml version="1.0" encoding="utf-8" ?>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<wsdl:definitions
targetNamespace="*urn:sap-com:document:sap:rfc:functions*"xmlns:http
="*http://schemas.xmlsoap.org/wsdl/http/*" xmlns:soap="*
http://schemas.xmlsoap.org/wsdl/soap/*" xmlns:tns="*
urn:sap-com:document:sap:rfc:functions*" xmlns:wsdl="*
http://schemas.xmlsoap.org/wsdl/*" xmlns:xsd="*
http://www.w3.org/2001/XMLSchema*">
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<wsdl:types>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:schema xmlns:xsd="*http://www.w3.org/2001/XMLSchema*" xmlns:tns="*
urn:sap-com:document:sap:rfc:functions*" targetNamespace="*
urn:sap-com:document:sap:rfc:functions*"
elementFormDefault="*unqualified*"attributeFormDefault
="*qualified*">
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:simpleType name="*char100*">
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:restriction base="*xsd:string*">
   <xsd:maxLength value="*100*" />
  xsd:restriction>
  xsd:simpleType>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:simpleType name="*char20*">
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:restriction base="*xsd:string*">
   <xsd:maxLength value="*20*" />
  xsd:restriction>
  xsd:simpleType>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:simpleType name="*char250*">
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:restriction base="*xsd:string*">
   <xsd:maxLength value="*250*" />
  xsd:restriction>
  xsd:simpleType>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:simpleType name="*char50*">
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:restriction base="*xsd:string*">
   <xsd:maxLength value="*50*" />
  xsd:restriction>
  xsd:simpleType>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:simpleType name="*numeric3*">
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:restriction base="*xsd:string*">
   <xsd:maxLength value="*3*" />
   <xsd:pattern value="*\d**" />
  xsd:restriction>
  xsd:simpleType>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:complexType name="*ZWS_RECORD_SIMPLE*">
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:sequence>
   <xsd:element name="*PRODUCT_ID*" type="*tns:char50*" />
   <xsd:element name="*PRODUCT_NUMBER*" type="*tns:char20*" />
   <xsd:element name="*ALTERNATE_NAME*" type="*tns:char100*" />
   <xsd:element name="*DESCRIPTION*" type="*tns:char250*" />
  xsd:sequence>
  xsd:complexType>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:complexType name="*ZWSTAB_RECORD_SIMPLE*">
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:sequence>
   <xsd:element name="*item*" minOccurs="*0*" maxOccurs="*unbounded*" type="
*tns:ZWS_RECORD_SIMPLE*" />
  xsd:sequence>
  xsd:complexType>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:element name="*ZMDM_WEBSERVICE*">
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:complexType>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:sequence>
   <xsd:element name="*NUMBER_OF_PRODUCT*" type="*tns:numeric3*" />
  xsd:sequence>
  xsd:complexType>
  xsd:element>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:element name="*ZMDM_WEBSERVICEResponse*">
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:complexType>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<xsd:sequence>
   <xsd:element name="*ZMDM_PRODUCT*" type="*tns:ZWSTAB_RECORD_SIMPLE*" />
  xsd:sequence>
  xsd:complexType>
  xsd:element>
  xsd:schema>
  wsdl:types>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<wsdl:message name="*ZMDM_WEBSERVICE*">
   <wsdl:part name="*parameters*" element="*tns:ZMDM_WEBSERVICE*" />
  wsdl:message>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<wsdl:message name="*ZMDM_WEBSERVICEResponse*">
   <wsdl:part name="*parameters*" element="*tns:ZMDM_WEBSERVICEResponse*" />
  wsdl:message>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<wsdl:portType name="*ZMDM_WEBSERVICE*">
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<wsdl:operation name="*ZMDM_WEBSERVICE*">
   <wsdl:input message="*tns:ZMDM_WEBSERVICE*" />
   <wsdl:output message="*tns:ZMDM_WEBSERVICEResponse*" />
  wsdl:operation>
  wsdl:portType>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<wsdl:binding name="*ZMDM_WEBSERVICESoapBinding*" type="*tns:ZMDM_WEBSERVICE
*">
   <soap:binding style="*document*" transport="*
http://schemas.xmlsoap.org/soap/http*" />
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<wsdl:operation name="*ZMDM_WEBSERVICE*">
   <soap:operation soapAction="" />
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<wsdl:input>
   <soap:body use="*literal*" />
  wsdl:input>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<wsdl:output>
   <soap:body use="*literal*" />
  wsdl:output>
  wsdl:operation>
  wsdl:binding>
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<wsdl:service name="*ZMDM_WEBSERVICEService*">
 -<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1#>
<wsdl:port name="*ZMDM_WEBSERVICESoapBinding*" binding="*
tns:ZMDM_WEBSERVICESoapBinding*">
   <soap:address location="*
http://sapbisbx.test.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?sap-client=001<http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?sap-client=001>
*" />
  wsdl:port>
  wsdl:service>
  wsdl:definitions>


Here is the content of config-wsdl.xml content:
*
<configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">

  <wsdl location="
http://sapbisbx.cadence.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1"
packageName="Test" />
</configuration>*

This is my client dynamic invocation program:
package Test;

import java.net.URL;
import javax.xml.rpc.Service;
import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
import javax.xml.rpc.ServiceFactory;
//import dynamicproxy.ZMDM_WEBSERVICE;
import javax.xml.rpc.soap.SOAPFaultException;
import Test.*;



public class SapClient {

   private String endpointAddress;

   public static void main(String argv[]) {
      try {
         // Invoke createProxy() to create a stub object
         //Stub stub = createProxy();
         String nameSpaceUri = "urn:sap-com:document:sap:rfc:functions";

         String serviceName = "ZMDM_WEBSERVICEService";
         String portName = "ZMDM_WEBSERVICESoapBinding";
         //String portName ="ZTEST_MY_NEW";


         // Set the endpoint address the stub uses to access the service
         URL url = new URL( "
http://sapbisbx.test.com:8000/sap/bc/srt/rfc/sap/ZMDM_WEBSERVICE?wsdl=1.1");
      // Create an instance of service factory
         ServiceFactory serviceFactory = ServiceFactory.newInstance();

         // Create a service object to act as a factory for proxies.
         Service mathService = serviceFactory.createService(url,
                    new QName(nameSpaceUri, serviceName));
      // Create a proxy
         ZWS_RECORD_SIMPLE
                    myProxy = (ZWS_RECORD_SIMPLE) mathService.getPort(new
                        QName(nameSpaceUri,
                    portName), ZWS_RECORD_SIMPLE.class);
         // Cast the stub to the service endpoint interface (MathFace)

       ZtestMy2[ ] rec = myProxy.ztestMyNew("SYNCED").getItem();
       if(rec!=null)
          {
                System.out.println("
PRODUCT_ID EosuuportDate
ProductNumber ApproveStatus") ;
             for (int i=0;i<rec.length ; i++ )
             {
                System.out.println(rec[i].getProductId()+"
"+rec[i].getEosupportDate()+" " +rec[i].getProductNumber() +" "+
rec[i].getApproveStatus()) ;

             }
          }
             else
                System.out.println("Return Value ---no records");
        */
         //System.out.println("Return Value ---
"+math.ZTEST_MY("SYNCED").getItem());
      }catch (SOAPFaultException e)
      {
          System.out.println("In Soap Exception Block");
          System.out.println(" Soap Exception " +e.getDetail());
          e.getDetail();
      }
      /*catch (ClassNotFoundException e)
      {
          e.printStackTrace();
      } */
      /*catch (ServiceException e)
      {
          e.printStackTrace();
      }*/ catch (Exception ex) {
         ex.printStackTrace();
      }
   }

   }


Problem :
    If i run using Java command at the console, its throws me exception :

D:\Webservice\Dynamic-proxy3\build>java Test.SapClient
port: {urn:sap-com:document:sap:rfc:functions}ZMDM_WEBSERVICESoapBinding
does no
t contain operation: getPRODUCT_ID
        at
com.sun.xml.rpc.client.dii.ConfiguredCall.configureCall(ConfiguredCal
l.java:98)
        at
com.sun.xml.rpc.client.dii.ConfiguredCall.configureCall(ConfiguredCal
l.java:69)
        at
com.sun.xml.rpc.client.dii.ConfiguredCall.setMethodName(ConfiguredCal
l.java:50)
        at
com.sun.xml.rpc.client.dii.DynamicProxyBuilder.buildDynamicProxyFor(D
ynamicProxyBuilder.java:66)
        at
com.sun.xml.rpc.client.dii.ConfiguredService.getPort(ConfiguredServic
e.java:250)
        at Test.SapClient.main(SapClient.java:39)



Request you to help me to over come this issue...
Thanks a bunch in advance...

-- 
Regards,
-Vj