Issue with Dynamic invocation of Webservices JAX RPC

View: New views
1 Messages — Rating Filter:   Alert me  

Issue with Dynamic invocation of Webservices JAX RPC

by Vijay Kumar M :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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


  xml version="1.0" encoding="utf-8" ?>
- <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">
- <wsdl:types>
- <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">
- <xsd:simpleType name="char100">
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="100" />
  xsd:restriction>
  xsd:simpleType>
- <xsd:simpleType name="char20">
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="20" />
  xsd:restriction>
  xsd:simpleType>
- <xsd:simpleType name="char250">
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="250" />
  xsd:restriction>
  xsd:simpleType>
- <xsd:simpleType name="char50">
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="50" />
  xsd:restriction>
  xsd:simpleType>
- <xsd:simpleType name="numeric3">
- <xsd:restriction base="xsd:string">
  <xsd:maxLength value="3" />
  <xsd:pattern value="\d*" />
  xsd:restriction>
  xsd:simpleType>
- <xsd:complexType name="ZWS_RECORD_SIMPLE">
- <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>
- <xsd:complexType name="ZWSTAB_RECORD_SIMPLE">
- <xsd:sequence>
  <xsd:element name="item" minOccurs="0" maxOccurs="unbounded" type="tns:ZWS_RECORD_SIMPLE" />
  xsd:sequence>
  xsd:complexType>
- <xsd:element name="ZMDM_WEBSERVICE">
- <xsd:complexType>
- <xsd:sequence>
  <xsd:element name="NUMBER_OF_PRODUCT" type="tns:numeric3" />
  xsd:sequence>
  xsd:complexType>
  xsd:element>
- <xsd:element name="ZMDM_WEBSERVICEResponse">
- <xsd:complexType>
- <xsd:sequence>
  <xsd:element name="ZMDM_PRODUCT" type="tns:ZWSTAB_RECORD_SIMPLE" />
  xsd:sequence>
  xsd:complexType>
  xsd:element>
  xsd:schema>
  wsdl:types>
- <wsdl:message name="ZMDM_WEBSERVICE">
  <wsdl:part name="parameters" element="tns:ZMDM_WEBSERVICE" />
  wsdl:message>
- <wsdl:message name="ZMDM_WEBSERVICEResponse">
  <wsdl:part name="parameters" element="tns:ZMDM_WEBSERVICEResponse" />
  wsdl:message>
- <wsdl:portType name="ZMDM_WEBSERVICE">
- <wsdl:operation name="ZMDM_WEBSERVICE">
  <wsdl:input message="tns:ZMDM_WEBSERVICE" />
  <wsdl:output message="tns:ZMDM_WEBSERVICEResponse" />
  wsdl:operation>
  wsdl:portType>
- <wsdl:binding name="ZMDM_WEBSERVICESoapBinding" type="tns:ZMDM_WEBSERVICE">
  <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
- <wsdl:operation name="ZMDM_WEBSERVICE">
  <soap:operation soapAction="" />
- <wsdl:input>
  <soap:body use="literal" />
  wsdl:input>
- <wsdl:output>
  <soap:body use="literal" />
  wsdl:output>
  wsdl:operation>
  wsdl:binding>
- <wsdl:service name="ZMDM_WEBSERVICEService">
- <wsdl:port name="ZMDM_WEBSERVICESoapBinding" binding="tns:ZMDM_WEBSERVICESoapBinding">
  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