You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Andrew J. Leer (JIRA)" <ji...@apache.org> on 2007/02/20 06:12:05 UTC
[jira] Updated: (AXIS2-2222) When
[ https://issues.apache.org/jira/browse/AXIS2-2222?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andrew J. Leer updated AXIS2-2222:
----------------------------------
Attachment: wsaxis2demoBug.zip
Deepal,
Here are the files that caused this bug to occur. I have placed them in a zip file for you.
> When
> -----
>
> Key: AXIS2-2222
> URL: https://issues.apache.org/jira/browse/AXIS2-2222
> Project: Axis 2.0 (Axis2)
> Issue Type: Bug
> Affects Versions: 1.1.1
> Environment: WindowsXP Service Pack 2, Maven2, Java 1.5, Duo Core Processor
> Reporter: Andrew J. Leer
> Attachments: wsaxis2demoBug.zip
>
>
> The Error wrote:
> org.apache.axis2.AxisFault: Transport out has not been set
> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:662)
> at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:237)
> at org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
> at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:579)
> at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:508)
> at com.mooo.mv.demo.ws.AppTest.testServiceClient(AppTest.java:111)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at junit.framework.TestSuite.runTest(TestSuite.java:208)
> at junit.framework.TestSuite.run(TestSuite.java:203)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
> package com.mooo.mv.demo.ws;
> import java.io.PrintStream;
> import java.io.StringReader;
> import javax.xml.namespace.QName;
> import javax.xml.stream.XMLInputFactory;
> import javax.xml.stream.XMLStreamReader;
> 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.axiom.om.impl.builder.StAXOMBuilder;
> import org.apache.axis2.Constants;
> import org.apache.axis2.addressing.AddressingConstants;
> import org.apache.axis2.addressing.EndpointReference;
> import org.apache.axis2.client.Options;
> import org.apache.axis2.client.ServiceClient;
> import org.apache.axis2.description.TransportOutDescription;
> import org.apache.axis2.transport.http.HTTPConstants;
> import junit.framework.Test;
> import junit.framework.TestCase;
> import junit.framework.TestSuite;
> /**
> * Unit test for simple App.
> */
> public class AppTest
> extends TestCase
> {
> /**
> * Create the test case
> *
> * @param testName name of the test case
> */
> public AppTest( String testName )
> {
> super( testName );
> }
> /**
> * @return the suite of tests being tested
> */
> public static Test suite()
> {
> return new TestSuite( AppTest.class );
> }
> public static OMElement getPayload()
> {
> OMFactory fac = OMAbstractFactory.getOMFactory();
> OMNamespace omNs = fac.createOMNamespace("http://bible.sumerano.com/", "tns");
> OMElement method = fac.createOMElement("GetTranslations", omNs);
> // OMElement method = fac.createOMElement("getPrice", omNs);
> // OMElement value = fac.createOMElement("symbol", omNs);
> // value.addChild(fac.createOMText(value, symbol));
> // method.addChild(value);
> return method;
> }
> public void testServiceClient() throws Exception
> {
> OMElement xmlPayload = getPayload();
> PrintStream ps = System.out;
> xmlPayload.serialize(ps);
> Options options = new Options();
> options.setTo(new EndpointReference("http://bible.sumerano.com/bible.asmx?WSDL"));
> options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> ServiceClient sender = new ServiceClient();
> sender.setOptions(options);
> options.setUseSeparateListener(false);
> OMElement result = sender.sendReceive(xmlPayload);
> result.serialize(ps);
> }
> }
> Now I understand that I've already set the "in" transport protocol. But I really do not know how to set the "out" transport protocol or why I have to do it. The client example in the Axis2 documentation (http://ws.apache.org/axis2/1_1_1/quickstartguide.html) does not require this:
> Client Example from quick start guide wrote:
> package samples.quickstart.clients;
> 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.Constants;
> import org.apache.axis2.addressing.EndpointReference;
> import org.apache.axis2.client.Options;
> import org.apache.axis2.client.ServiceClient;
> public class AXIOMClient {
> private static EndpointReference targetEPR =
> new EndpointReference("http://localhost:8080/axis2/services/StockQuoteService");
> public static OMElement getPricePayload(String symbol) {
> OMFactory fac = OMAbstractFactory.getOMFactory();
> OMNamespace omNs = fac.createOMNamespace("http://axiom.service.quickstart.samples/xsd", "tns");
> OMElement method = fac.createOMElement("getPrice", omNs);
> OMElement value = fac.createOMElement("symbol", omNs);
> value.addChild(fac.createOMText(value, symbol));
> method.addChild(value);
> return method;
> }
> public static OMElement updatePayload(String symbol, double price) {
> OMFactory fac = OMAbstractFactory.getOMFactory();
> OMNamespace omNs = fac.createOMNamespace("http://axiom.service.quickstart.samples/xsd", "tns");
> OMElement method = fac.createOMElement("update", omNs);
> OMElement value1 = fac.createOMElement("symbol", omNs);
> value1.addChild(fac.createOMText(value1, symbol));
> method.addChild(value1);`q
> OMElement value2 = fac.createOMElement("price", omNs);
> value2.addChild(fac.createOMText(value2,
> Double.toString(price)));
> method.addChild(value2);
> return method;
> }
> public static void main(String[] args) {
> try {
> OMElement getPricePayload = getPricePayload("WSO");
> OMElement updatePayload = updatePayload("WSO", 123.42);
> Options options = new Options();
> options.setTo(targetEPR);
> options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> ServiceClient sender = new ServiceClient();
> sender.setOptions(options);
> sender.fireAndForget(updatePayload);
> System.err.println("done");
> OMElement result = sender.sendReceive(getPricePayload);
> String response = result.getFirstElement().getText();
> System.err.println("Current price of WSO: " + response);
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
> }
> Is this something that hasn't been updated in the tutorial or is there something that I'm missing here?
> Thank you,
> Andrew J. Leer
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org