I am a newbie to Axis2. I am using the example under:
I created a web application and deployed that application in the webserber (WebSphere test server 6.1 in this cases that comes with RAD 7.5). I can see my web page as: http://localhost:9081/MyAxis2/index.html However, I do not see any registered the registered service when I log in to Axis admin console. I deployed axis2.war (which comes with Axis2 1.5 download). I can successfully see http://localhost:9081/axis2/ and see getVersion service registered. When I run my client, I get error as below: Sep 30, 2009 5:14:52 PM org.apache.axis2.deployment.ModuleDeployer deploy INFO: Deploying module: metadataExchange-1.5 - file:/C:/workspace-7.5/MyAxis2/WebContent/WEB-INF/lib/mex-1.5.jar Sep 30, 2009 5:15:00 PM org.apache.axis2.transport.http.HTTPSender sendViaPost INFO: Unable to sendViaPost to url[http://localhost:9081/MyAxis2/CalculatorService] org.apache.axis2.AxisFault: Transport error: 404 Error: Not Found at org.apache.axis2.transport.http.HTTPSender.handleResponse(HTTPSender.java:295) at org.apache.axis2.transport.http.HTTPSender.sendViaPost(HTTPSender.java:190) at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:75) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:389) at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:222) at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:435) at org.apache.axis2.description.OutOnlyAxisOperationClient.executeImpl(OutOnlyAxisOperation.java:272) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) at org.apache.axis2.client.ServiceClient.fireAndForget(ServiceClient.java:506) at org.apache.axis2.client.ServiceClient.fireAndForget(ServiceClient.java:483) at CalculatorClient.main(CalculatorClient.java:43) Transport error: 404 Error: Not Found My client code: import org.apache.axiom.om.OMNamespace; import org.apache.axiom.om.OMElement; import org.apache.axis2.client.Options; import org.apache.axiom.om.OMFactory; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.Constants; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axis2.client.ServiceClient; public class CalculatorClient { private static EndpointReference targetEPR = new EndpointReference("http://localhost:9081/MyAxis2/CalculatorService"); public static void main(String[] args) { try { OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMNamespace omNamespace = omFactory.createOMNamespace ("http://localhost:9081/MyAxis2", "c"); OMElement method1 = omFactory.createOMElement("setTerms", omNamespace); OMElement value1 = omFactory.createOMElement("t1", omNamespace); value1.addChild(omFactory.createOMText(value1, "3.5")); method1.addChild(value1); OMElement value2 = omFactory.createOMElement("t2", omNamespace); value2.addChild(omFactory.createOMText(value2,"3.2")); method1.addChild(value2); OMElement method2 = omFactory.createOMElement("getResult", omNamespace); OMElement value3 = omFactory.createOMElement("operation", omNamespace); value3.addChild(omFactory.createOMText(value3, "multiply")); //or:"add", "subtract", "divide" method2.addChild(value3); Options options = new Options(); options.setTo(targetEPR); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); ServiceClient serviceClient = new ServiceClient(); serviceClient.setOptions(options); serviceClient.fireAndForget(method1); // Exception is thrown in this line Thread.sleep(1000000); OMElement result = serviceClient.sendReceive(method2); String response = result.getFirstElement().getText(); System.out.println("Result for *multiply* operation : " + response); } catch (Exception e) { System.out.println(e.getMessage()); } } } Exception is thrown on line: serviceClient.fireAndForget(method1); I have not kept the class in any package at this time (it is in default package). Name of the project is MyAxis2 and I can access http://localhost:9081/MyAxis2/index.html when the server runs. My server code is: import javax.xml.stream.XMLStreamException; import javax.xml.namespace.QName; //Axis2 classes import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMNamespace; public class CalculatorService { private float term_1; private float term_2; //private String namespace = "http://www.simpleCalculator.com/calculator"; [b]private String namespace = "http://localhost:9081/MyAxis2";[/b] public void setTerms(OMElement element) throws XMLStreamException { element.build(); element.detach(); OMElement term1Element = element.getFirstChildWithName(new QName(namespace, "t1")); OMElement term2Element = element.getFirstChildWithName(new QName(namespace, "t2")); term_1 = Float.valueOf(term1Element.getText()).floatValue(); term_2 = Float.valueOf(term2Element.getText()).floatValue(); } public OMElement getResult(OMElement element) throws XMLStreamException { element.build(); element.detach(); float result = 0.0f; OMElement operationElement = element.getFirstElement(); String operation = operationElement.getText(); if(operation.equalsIgnoreCase ("add")){ result = term_1 + term_2; } if(operation.equalsIgnoreCase ("subtract")){ result = term_1 - term_2; } if(operation.equalsIgnoreCase ("multiply")){ result = term_1 * term_2; } if(operation.equalsIgnoreCase ("divide")){ result = term_1 / term_2; } OMFactory omFactory = OMAbstractFactory.getOMFactory(); OMNamespace omNamespace = omFactory.createOMNamespace(namespace, "ns"); OMElement answer = omFactory.createOMElement("getResultResponse", omNamespace); OMElement value = omFactory.createOMElement("answer", omNamespace); value.addChild(omFactory.createOMText (value, String.valueOf(result))); answer.addChild(value); return answer; } } Again, the server is also in the same default package, as the client code. As I mentioned before, I just deployed this application (as war file) in the test server (WebSphere test server 6.1 that comes with RAD 7.5). It is not a jar file. And I did not convert the WAR file to aar file. Any suggestion will be appreciated. -- View this message in context: http://www.nabble.com/Axis2-%281.5%29---AxisFault%3A-Transport-error%3A-404-Error-tp25689461p25689461.html Sent from the Axis - User mailing list archive at Nabble.com.
