Prabhakar Chandrasekaran wrote:


I am working with Java Binding trying to access a simple class through a WSDL. I have the following error occurring when I execute the above two files with WSIF,


org.apache.wsif.WSIFException: Binding {http://JavaBindTesterPack}JavaBinding does not contain a typeMap with encoding=Java and style=Java

Though I have given type mapping this error occurs.

JavaBind.wsdl – The WSDL file

JavaIntClient.java – The dii wsif client

JavaIntTester.java – The class which I am trying to access through JavaBinding

Please help me in resolving the above error, its very urgent.

what version of WSIF are using? did you try current CVS and/or nightly build?

did you try to run samples/localjava? did it work?

anyway aftrer i editied WSDL file (correct part name and no mapping needed for Java "int") and java client to coinsistetly use "int" all is working fine. see attached files.

JavaIntClient
[EMAIL PROTECTED] name:null parts[0]:5
result=10

alek

Thanks and Regards,

*Prabhakar Chandrasekaran*

*Team Virtusa*

*Office: 91 44 5200 2700 Ext. 3313**
**Mobile**: 91 94430 37499 *

*www.virtusa.com <http://www.virtusa.com/>** *

---------------------------------------------------------------------------------------------
This message, including any attachments, contains confidential information intended for a specific individual and purpose, and is intended for the addressee only. Any unauthorized disclosure, use, dissemination, copying, or distribution of this message or any of its attachments or the information contained in this e-mail, or the taking of any action based on it, is strictly prohibited. If you are not the intended recipient, please notify the sender immediately by return e-mail and delete this message.




--
The best way to predict the future is to invent it - Alan Kay

import org.apache.wsif.WSIFMessage;
import org.apache.wsif.WSIFOperation;
import org.apache.wsif.WSIFPort;
import org.apache.wsif.WSIFService;
import org.apache.wsif.WSIFServiceFactory;
import org.apache.wsif.providers.java.WSIFDynamicProvider_Java;
import org.apache.wsif.util.WSIFPluggableProviders;
//import org.apache.wsif.WSIFOperation_EJB;


public class JavaIntClient
{
    public static void main(String[] args)
    {
        try
        {
            
            WSIFPluggableProviders.overrideDefaultProvider(
                "http://schemas.xmlsoap.org/wsdl/java/";,
                new WSIFDynamicProvider_Java());
            
            String inputString = null;
            String outputString = null;
            
            inputString = "The Great";
            WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
            WSIFService service = factory.getService(
                
"C:\\Forge\\ws-apache-cvs\\ws-wsif\\feedback\\java_binding_prabhakar\\JavaBind.wsdl",
                null,null,  //service
                "http://JavaBindTesterPack";, "JavaBindTesterPT");
            
            //service.mapType(new QName("http://WSIFUserPack";, 
"java.lang.String"), Class.forName("java.lang.String"));
            
            WSIFPort port = service.getPort();
            WSIFOperation operation = port.createOperation("getInt");
            WSIFMessage input = operation.createInputMessage();
            WSIFMessage output = operation.createOutputMessage();
            WSIFMessage fault = operation.createFaultMessage();
            
            //input.setObjectPart("inp", new Integer(5));
            input.setIntPart("inp", 5);
            System.out.println(input);
            //System.out.println("Completed");
            if (operation.executeRequestResponseOperation(input, output, fault))
            {
                //Integer i =  (Integer)output.getObjectPart("oup");
                int i =  output.getIntPart("oup");
                System.out.println( "result="+i);
            }
            else
            {
                System.out.println("Invocation failed");
            }
        }
        catch (Exception e)
        {
            //System.out.println(e);
            e.printStackTrace();
        }
    }
}

<?xml version="1.0" ?>

<definitions targetNamespace="http://JavaBindTesterPack";
             xmlns:tns="http://JavaBindTesterPack";
             xmlns:typens="http://www.ibm.com/namespace/wsif/samples/ab/types";
             xmlns:xsd="http://www.w3.org/2001/XMLSchema";
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
             xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/";
             xmlns:java="http://schemas.xmlsoap.org/wsdl/java/";
             xmlns:ejb="http://schemas.xmlsoap.org/wsdl/ejb/";
             xmlns="http://schemas.xmlsoap.org/wsdl/";>

  <types>
  </types>

  <message name="getIntRequestMessage">
    <part name="inp" type="xsd:int"/>
  </message>

  <message name="getIntResponseMessage">
    <part name="oup" type="xsd:int"/>
  </message>

  <portType name="JavaBindTesterPT">
    <operation name="getInt">
      <input name="getIntRequest"
              message="tns:getIntRequestMessage"/>
      <output name="getIntResponse"
              message="tns:getIntResponseMessage"/>
 </operation>
  </portType>

  <binding name="JavaBinding" type="tns:JavaBindTesterPT">
    <java:binding/>

   <format:typeMapping encoding="Java" style="Java">
      <format:typeMap typeName="xsd:int" formatType="int"/>
    </format:typeMapping>

    <operation name="getInt">
      <java:operation
         methodName="getInt"
         parameterOrder="inp"
         methodType="instance"
         returnPart="oup"/>
      <input name="getIntRequest"/>
      <output name="getIntResponse"/>
    </operation>
  </binding>

  <service name="JavaBindService">
    <port name="JavaPort" binding="tns:JavaBinding">
      <java:address className="JavaBindTesterPack.JavaIntTester"/>
    </port>
  </service>

</definitions>




package JavaBindTesterPack;

public class JavaIntTester
{
    public int getInt (int n)
    {
        return n * 2;
    }
    //    public Integer getInt (Integer n)
    //    {
    //        System.err.println(getClass().getName()+" invoked with n="+n);
    //        return new Integer(n.intValue() * 2);
    //    }
}


Reply via email to