You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Iskar <pk...@gmail.com> on 2011/01/13 11:44:32 UTC

org.apache.axis2.AxisFault: unknown while calling working WebService

Hi,

I have written a simple Web Service and deployed it to axis2-1.5.3's simple
web server, services.xml file looks like that:

<service>
    <parameter name="ServiceClass" locked="false">hp.main.WSMain</parameter>
    <operation name="addSample">
        <messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
    </operation>
    <operation name="addSampleTypes">
        <messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
    </operation>
    <operation name="getSampleTypes">
        <messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
    </operation>
    <operation name="getPrivileges">
        <messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
    </operation>
</service>

When I call getSampleTypes using for example SoapUI application, everything
works correctly - server gives correct results. I wrote a client for that
web service in Java using the same axis2 jars. The code I used was from the
Axis2 site, I just added few more elements i needed. And now: when I send
incorrect request (for example, I omit a mandatory element), server
responses with a correct message. However, when the request is correct, I
get the:
org.apache.axis2.AxisFault: unknown
        at
org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:446)
        at
org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
        at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
        at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
        at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
        at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:540)
        at
org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:521)
        at hp.main.ClientMain.main(ClientMain.java:50)

Here comes the code of the client:

package hp.main;

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;
import org.apache.log4j.PropertyConfigurator;

public class ClientMain {
    private static EndpointReference targetEPR =
        new
EndpointReference("http://localhost:8080/axis2/services/TestWS");

    public static OMElement createSampleTypesElement() {
        OMFactory factory = OMAbstractFactory.getOMFactory();
        OMNamespace hpNamespace =
factory.createOMNamespace("http://www.test.com", "hp");
        OMNamespace hpcommNamespace =
factory.createOMNamespace("http://www.test.com/commons", "hpc");

        OMElement reqRoot = factory.createOMElement("getSampleTypes",
hpNamespace);
        OMElement userData = factory.createOMElement("UserData",
hpcommNamespace);
        reqRoot.addChild(userData);
       
        OMElement loginElement = factory.createOMElement("Login",
hpcommNamespace);
        userData.addChild(loginElement);
        loginElement.addChild(factory.createOMText("test"));
       
        OMElement passwordElement = factory.createOMElement("test",
hpcommNamespace);
        userData.addChild(passwordElement);
        passwordElement.addChild(factory.createOMText("password"));
       
        return reqRoot;
    }

    public static void main(String[] args) {
        try {
            PropertyConfigurator.configure("log/properties.txt");
           
            OMElement getSampleTypes = createSampleTypesElement();

            Options options = new Options();
            options.setTo(targetEPR);
            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

            ServiceClient sender = new ServiceClient();
            sender.setOptions(options);
           
            OMElement result = sender.sendReceive(getSampleTypes);
            System.out.println(result.getText());
           
            OMElement statusElement =
(OMElement)result.getChildrenWithLocalName("Status").next();
            if (statusElement == null) {
                System.out.println("statusElement jest pusty...");
            } else System.out.println("Status = " +
statusElement.getText());

            OMElement messageElement =
(OMElement)result.getChildrenWithLocalName("Message").next();
            if (messageElement == null) {
                System.out.println("messageElement jest pusty...");
            } else System.out.println("Message = " +
messageElement.getText());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

The error message is at line:

            OMElement result = sender.sendReceive(getSampleTypes);

Can anyone please help me please? I have no idea what's wrong, because the
SoapUI tool gets the correct results every time, and the client gets correct
results too, but only when the request is improper. I tried checking
server's side log, but I couldn't get anything useful from there. 
-- 
View this message in context: http://old.nabble.com/org.apache.axis2.AxisFault%3A-unknown-while-calling-working-WebService-tp30661091p30661091.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
For additional commands, e-mail: java-user-help@axis.apache.org


RE: soap message creation

Posted by henry human <he...@yahoo.de>.
thanks, I tested this tool. It throws some c++ errors! it did not runing for me.. 

--- George Stanchev <Gs...@serena.com> schrieb am Di, 18.1.2011:

Von: George Stanchev <Gs...@serena.com>
Betreff: RE: soap message creation
An: "java-user@axis.apache.org" <ja...@axis.apache.org>
Datum: Dienstag, 18. Januar, 2011 20:33 Uhr

http://wsdlpull.sourceforge.net/  George  From: henry human [mailto:henry_human@yahoo.de] 
Sent: Tuesday, January 18, 2011 12:17 PM
To: java-user@axis.apache.org
Subject: soap message creation  Hi
I am looking for any free JAVA or not JAVA tool(command line Tool or well documented API/ framework..) to generate SOAP messages from a given WSDL. For example run the tool from command line and give the path to the wsdl file or call tool in code and give the path to the wsdl file to create a soap message.Maybe someone has implemented such tool and can give a hint.  


RE: soap message creation

Posted by George Stanchev <Gs...@serena.com>.
http://wsdlpull.sourceforge.net/

George

From: henry human [mailto:henry_human@yahoo.de]
Sent: Tuesday, January 18, 2011 12:17 PM
To: java-user@axis.apache.org
Subject: soap message creation

Hi
I am looking for any free JAVA or not JAVA tool(command line Tool or well documented API/ framework..) to generate SOAP messages from a given WSDL. For example run the tool from command line and give the path to the wsdl file or call tool in code and give the path to the wsdl file to create a soap message.Maybe someone has implemented such tool and can give a hint.



soap message creation

Posted by henry human <he...@yahoo.de>.
Hi
I am looking for any free JAVA or not JAVA tool(command line Tool or well documented API/ framework..) to generate SOAP messages from a given WSDL. For example run the tool from command line and give the path to the wsdl file or call tool in code and give the path to the wsdl file to create a soap message.Maybe someone has implemented such tool and can give a hint.





Re: org.apache.axis2.AxisFault: unknown while calling working WebService

Posted by Amila Suriarachchi <am...@gmail.com>.
On Thu, Jan 13, 2011 at 4:14 PM, Iskar <pk...@gmail.com> wrote:

>
> Hi,
>
> I have written a simple Web Service and deployed it to axis2-1.5.3's simple
> web server, services.xml file looks like that:
>
> <service>
>    <parameter name="ServiceClass" locked="false">hp.main.WSMain</parameter>
>    <operation name="addSample">
>        <messageReceiver
> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>    </operation>
>    <operation name="addSampleTypes">
>        <messageReceiver
> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>    </operation>
>    <operation name="getSampleTypes">
>        <messageReceiver
> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>    </operation>
>    <operation name="getPrivileges">
>        <messageReceiver
> class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>
>    </operation>
> </service>
>
> When I call getSampleTypes using for example SoapUI application, everything
> works correctly - server gives correct results. I wrote a client for that
> web service in Java using the same axis2 jars. The code I used was from the
> Axis2 site, I just added few more elements i needed. And now: when I send
> incorrect request (for example, I omit a mandatory element), server
> responses with a correct message. However, when the request is correct, I
> get the:
> org.apache.axis2.AxisFault: unknown
>        at
>
> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:446)
>        at
>
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:371)
>        at
>
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:417)
>        at
>
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
>        at
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
>        at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:540)
>        at
> org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:521)
>        at hp.main.ClientMain.main(ClientMain.java:50)
>
> Here comes the code of the client:
>
> package hp.main;
>
> 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;
> import org.apache.log4j.PropertyConfigurator;
>
> public class ClientMain {
>    private static EndpointReference targetEPR =
>        new
> EndpointReference("http://localhost:8080/axis2/services/TestWS");
>
>    public static OMElement createSampleTypesElement() {
>        OMFactory factory = OMAbstractFactory.getOMFactory();
>        OMNamespace hpNamespace =
> factory.createOMNamespace("http://www.test.com", "hp");
>        OMNamespace hpcommNamespace =
> factory.createOMNamespace("http://www.test.com/commons", "hpc");
>
>        OMElement reqRoot = factory.createOMElement("getSampleTypes",
> hpNamespace);
>        OMElement userData = factory.createOMElement("UserData",
> hpcommNamespace);
>        reqRoot.addChild(userData);
>
>        OMElement loginElement = factory.createOMElement("Login",
> hpcommNamespace);
>        userData.addChild(loginElement);
>        loginElement.addChild(factory.createOMText("test"));
>
>        OMElement passwordElement = factory.createOMElement("test",
> hpcommNamespace);
>        userData.addChild(passwordElement);
>        passwordElement.addChild(factory.createOMText("password"));
>
>        return reqRoot;
>    }
>
>    public static void main(String[] args) {
>        try {
>            PropertyConfigurator.configure("log/properties.txt");
>
>            OMElement getSampleTypes = createSampleTypesElement();
>
>            Options options = new Options();
>            options.setTo(targetEPR);
>            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>
>            ServiceClient sender = new ServiceClient();
>            sender.setOptions(options);
>
>            OMElement result = sender.sendReceive(getSampleTypes);
>            System.out.println(result.getText());
>
>            OMElement statusElement =
> (OMElement)result.getChildrenWithLocalName("Status").next();
>            if (statusElement == null) {
>                System.out.println("statusElement jest pusty...");
>            } else System.out.println("Status = " +
> statusElement.getText());
>
>            OMElement messageElement =
> (OMElement)result.getChildrenWithLocalName("Message").next();
>            if (messageElement == null) {
>                System.out.println("messageElement jest pusty...");
>            } else System.out.println("Message = " +
> messageElement.getText());
>        } catch (Exception e) {
>            e.printStackTrace();
>        }
>    }
> }
>
> The error message is at line:
>
>            OMElement result = sender.sendReceive(getSampleTypes);
>
> Can anyone please help me please? I have no idea what's wrong, because the
> SoapUI tool gets the correct results every time, and the client gets
> correct
> results too, but only when the request is improper.


what do you mean by improper. this service should accept all the XML
messages.

thanks,
Amila.

> I tried checking
> server's side log, but I couldn't get anything useful from there.
> --
> View this message in context:
> http://old.nabble.com/org.apache.axis2.AxisFault%3A-unknown-while-calling-working-WebService-tp30661091p30661091.html
> Sent from the Axis - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>


-- 
Amila Suriarachchi
WSO2 Inc.
blog: http://amilachinthaka.blogspot.com/