You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsif-user@ws.apache.org by Max Widjaja <Ma...@gmx.net> on 2005/07/21 18:41:50 UTC

EJBPort cannot be found

Dears Sirs,

I have been trying to invoke an ejb through wsif until now I haven't
succeded in getting the EJBPort.
WSIFTest founds only SOAP- and JavaPort. 
Could anyone help me finding the mistake?

Thx,
Max 

Here is my java code and wsdl code.

/*
 * Created on 16.05.2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
import java.util.Iterator;

import org.apache.wsif.WSIFException;
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;

/**
 * @author m@X
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class WsifTest {

	public static void main(String[] args) {
		try {
			//create a service factory
	        WSIFServiceFactory factory = WSIFServiceFactory.newInstance();
	        WSIFService service = factory.getService("D:/hello.wsdl", 
	        										null, 
													null, 
													"http://www.actis.atosorigin.de/services/hello",
													"helloPT");
	        
	        Iterator it = service.getAvailablePortNames();
	        while(it.hasNext()){
	        	Object o = it.next();
	        	System.out.println(o);
	        }
	        
	        WSIFPort port = service.getPort();
	        
	        //calling method
	        WSIFOperation operation = port.createOperation("sayHello");
	        
	        //create the messages
	        WSIFMessage input = operation.createInputMessage();
	        WSIFMessage output = operation.createOutputMessage();
	        WSIFMessage fault = operation.createFaultMessage();
	        
	        //fill in the input message 
	        input.setObjectPart("sayHelloParam", "Max");
	        
	        //invoke the method
	        if (operation.executeRequestResponseOperation(input,output,fault))
{
	    		// invocation succeeded
	    		// extract the address from the output message
	    		String result = (String) output.getObjectPart("sayHelloReturn");
	    		System.out.println("Invoked succssfully: " + result);
	        } else {
	        	System.out.println(fault);
	        }
		} catch (WSIFException we) {
		    System.out.println("Got exception from WSIF, details:");
		    we.printStackTrace(); 


		}
	}
}

##################################################################################
WSDL
##################################################################################

<?xml version="1.0" encoding="UTF-8"?>
<definitions targetNamespace="http://www.actis.atosorigin.de/services/hello"

	xmlns:he="http://www.actis.atosorigin.de/services/hello"   
	xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
	xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
	xmlns:format="http://schemas.xmlsoap.org/wsdl/formatbinding/"
    xmlns:ejb="http://schemas.xmlsoap.org/wsdl/ejb/" 
    xmlns:java="http://schemas.xmlsoap.org/wsdl/java/"
	xmlns:xsd="http://www.w3.org/2001/XMLSchema"
	xmlns="http://schemas.xmlsoap.org/wsdl/">

   <message name="sayHelloRequest">
      <part name="sayHelloParam" type="xsd:string"/>
   </message>

   <message name="sayHelloResponse">
      <part name="sayHelloReturn" type="xsd:string"/>
   </message>
   
    <message name="sayHelloFault">
      <part name="faultMessage" type="xsd:string"/>
   </message>

   <portType name="helloPT">
      <operation name="sayHello" parameterOrder="sayHelloParam">
         <input message="he:sayHelloRequest" name="sayHelloRequest"/>
         <output message="he:sayHelloResponse" name="sayHelloResponse"/>
         <fault message="he:sayHelloFault" name="sayHelloFault"/>
      </operation>
   </portType>

   <binding name="HelloSoapBinding" type="he:helloPT">
      <soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="sayHello">
         <soap:operation soapAction=""/>
         <input name="sayHelloRequest">
            <soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.actis.atosorigin.de/services/hello" use="encoded"/>
         </input>
         <output name="sayHelloResponse">
            <soap:body
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.actis.atosorigin.de/services/hello" use="encoded"/>
         </output>
         <fault name="sayHelloFault">
            <soap:fault name="HelloFault"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="http://www.actis.atosorigin.de/services/hello" use="encoded"/>
         </fault>
      </operation>
   </binding>
   
   <binding name="HelloJavaBinding" type="he:helloPT">
   		<java:binding/>
    	<format:typeMapping encoding="Java" style="Java">
      		<format:typeMap typeName="xsd:string" formatType="java.lang.String"
/>
    	</format:typeMapping>
    	<operation name="sayHello">
      		<java:operation methodName="sayHello" methodType="instance"/>
      		<input/>
      		<output/>
    	</operation>       
  	</binding>
  	
  	<binding name="HelloEjbBinding" type="he:helloPT">
   		<ejb:binding/>
    	<format:typeMapping encoding="Java" style="Java">
      		<format:typeMap typeName="xsd:string"
formatType="java.lang.String"/>
    	</format:typeMapping>
    	<operation name="sayHello">
	    	<ejb:operation 
	      		methodName="sayHello"
	      		parameterOrder="sayHelloParam"
	      		interface="remote"/>
	      		<input name="sayHelloRequest"/>
	      		<output name="sayHelloResponse"/>
    	</operation>       
  	</binding>

   <service name="HelloService">
      <port name="SOAPPort" binding="he:HelloSoapBinding">
         <soap:address
location="http://localhost:8080/axis/services/Hello"/>
      </port>
      <port name="JavaPort" binding="he:HelloJavaBinding">
      	 <java:address className="services.hello.HelloImpl"/>
      </port>
      <port name="EJBPort" binding="he:HelloEjbBinding">
        	<!-- Put vendor-specific deployment information here -->
			<ejb:address className="services.hello.ejb.HelloSessionHome"
		     			jndiName="ejb/service/HelloSession"
                   
	initialContextFactory="org.jnp.interfaces.NamingContextFactory"
	             		jndiProviderURL="jnp://localhost:1099"/>
	  </port>
   </service>
   
   <plnk:partnerLinkType name="HelloLinkType">
       <plnk:role name="Responder">
           <plnk:portType name="he:helloPT"/>
       </plnk:role>
    </plnk:partnerLinkType>

</definitions>

-- 
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse f�r Mail, Message, More +++

-- 
5 GB Mailbox, 50 FreeSMS http://www.gmx.net/de/go/promail
+++ GMX - die erste Adresse f�r Mail, Message, More +++