[jboss-user] [JBoss Seam] - Accessing Seam Web Service
twocoasttb
do-not-reply at jboss.com
Thu Jul 5 19:47:06 EDT 2007
Has anyone had success writing a client for a Seam web service? I've got a skeleton modeled after the seambay example:
@Remote
| public interface AgentRemote {
|
| public void processOrder();
|
| }
@Stateless
| @WebService(name="AgentService", serviceName="AgentService")
| public class Agent implements AgentRemote {
|
| @WebMethod
| public void processOrder() {
| System.out.println("METHOD CALLED");
| }
|
| }
When deployed, I can get the following WSDL from the service:
<definitions name='AgentService' targetNamespace='http://service.web.tcsc.twocoast.com/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://service.web.tcsc.twocoast.com/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
| <types>
| <xs:schema targetNamespace='http://service.web.tcsc.twocoast.com/' version='1.0' xmlns:tns='http://service.web.tcsc.twocoast.com/' xmlns:xs='http://www.w3.org/2001/XMLSchema'>
| <xs:element name='processOrder' type='tns:processOrder'/>
| <xs:element name='processOrderResponse' type='tns:processOrderResponse'/>
| <xs:complexType name='processOrder'/>
| <xs:complexType name='processOrderResponse'/>
| </xs:schema>
| </types>
| <message name='AgentService_processOrder'>
| <part element='tns:processOrder' name='processOrder'></part>
| </message>
| <message name='AgentService_processOrderResponse'>
| <part element='tns:processOrderResponse' name='processOrderResponse'></part>
| </message>
| <portType name='AgentService'>
| <operation name='processOrder' parameterOrder='processOrder'>
| <input message='tns:AgentService_processOrder'></input>
| <output message='tns:AgentService_processOrderResponse'></output>
| </operation>
| </portType>
| <binding name='AgentServiceBinding' type='tns:AgentService'>
| <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
| <operation name='processOrder'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| </operation>
| </binding>
| <service name='AgentService'>
| <port binding='tns:AgentServiceBinding' name='AgentServicePort'>
| <soap:address location='http://127.0.0.1:8080/AgentService/Agent'/>
| </port>
| </service>
| </definitions>
I've tried writing simple clients in both Axis and Axis2. Here's the Axis2 version:
import org.apache.axiom.om.OMAbstractFactory;
| import org.apache.axiom.om.OMElement;
| import org.apache.axiom.om.OMFactory;
| import org.apache.axiom.om.OMNamespace;
| import org.apache.axis2.AxisFault;
| import org.apache.axis2.addressing.EndpointReference;
| import org.apache.axis2.client.Options;
| import org.apache.axis2.client.ServiceClient;
|
| public class Client {
| public static void main(String[] args) throws Exception {
|
| try {
|
| String endpoint="http://127.0.0.1:8080/AgentService/Agent";
| EndpointReference targetEPR = new EndpointReference(endpoint);
|
| OMFactory fac = OMAbstractFactory.getOMFactory();
| OMNamespace omNs = fac.createOMNamespace("http://twocoast.com/service", "tcsc");
| OMElement payload = fac.createOMElement("processOrder", omNs);
| Options options = new Options();
| options.setTo(targetEPR);
| //options.setAction("tcsc:processOrder");
|
| ServiceClient sender = new ServiceClient();
| sender.setOptions(options);
| OMElement result = sender.sendReceive(payload);
| sender.fireAndForget(result);
| } catch (AxisFault axisFault) {
| axisFault.printStackTrace();
| }
|
| }
| }
Regardless of the client, I get the following error in response to a request:
org.apache.axis2.AxisFault: Endpoint {http://service.web.tcsc.twocoast.com/}AgentServicePort does not contain operation meta data for: {http://twocoast.com/service}processOrder
| at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:434)
| at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:373)
| at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:294)
| at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:520)
| at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:500)
| at Client.main(Client.java:27)
I've seen this error referenced in the JBoss WS forums, but haven't found a definitive answer. Has anyone had more luck with this than I have? BTW, I'm deploying to JBoss AS 4.2.0.GA and using Seam 2.0.0.BETA1
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061071#4061071
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061071
More information about the jboss-user
mailing list