You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-user@ws.apache.org by ZHAO <zh...@gmail.com> on 2006/08/16 10:18:33 UTC

Invoke a call to Muse in Axis

Hello,

I want to add identification function and maintain sessions in the Muse
service. Now I have deployed one Muse service and one Axis service. I invoke
a call to Muse service from Axis implemention file.(e.g. Once the Axis
service receives a GetResourceProperty soap request, it will do the
invocation to Muse service to get the required resource property.)
The following is the code of method getResourceProperty in the Axis
generated impl file. But it dose not work, it returns a NullPointer
Exception. I don't know where the problem is. Can anyone help?
Thanks in advance.
I attach as well the WSDL file,  the GetResourceProperty.soap and
GetResourceProperty.xml.

    public
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponsegetResourceProperty(
javax.xml.namespace.QName getResourcePropertyRequest) throws
java.rmi.RemoteException,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.InvalidResourcePropertyQNameFaultType,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.ResourceUnknownFaultType{

        try{
            String endpoint="http://localhost:8080/muse/services/router5";
            String uri = "http://example.org/services/Router5";
            InputStream is =ClassLoader.getSystemResourceAsStream
("C:/axis-1_4/samples/AxisTest1/requests/GetResourceProperty.xml");
            System.err.print("input stream: "+is.toString());
            ServiceFactory sfactory = (org.apache.axis.client.ServiceFactory
)ServiceFactory.newInstance();

            URL wsdlURL = new URL("
http://localhost:8080/muse/services/router5?wsdl");
            QName serviceQname = new QName("
http://example.org/services/Router5", "RouterService");
            Service service =
(org.apache.axis.client.Service)sfactory.createService(wsdlURL,
serviceQname);
            //the port name becomes the service name in the wsdd generated
by Wsdl2Java
            QName portQname = new QName("http://example.org/services/Router5",
"router5");


            Call call = (Call)service.createCall
(portQname,"GetResourceProperty");
            call.setTargetEndpointAddress(endpoint);
            call.setProperty(Call.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
            call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
            call.setProperty(Call.SOAPACTION_URI_PROPERTY, uri);

            call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY, "");
            call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
            call.setOperationName(new QName("
http://example.org/services/Router5","GetResourceProperty"));

            QName qn1=new QName("
http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl
","GetResourceProperty");
//            QName qn2=new QName("
http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl
","GetResourcePropertyResponse");
            call.addParameter("ResourceId",qn1,ParameterMode.IN);
//            call.setReturnType(qn2,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponse.class
);
//            QName qn3=new QName("http://example.org/services/Router5
","ResourceId");
//            String stri="ResourceId";
//            Object[] ob=(stri);
//
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponseres=(
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponse
)call.invoke(qn3,ob);


            org.apache.axis.message.SOAPEnvelope envelope = new
org.apache.axis.message.SOAPEnvelope();
            org.apache.axis.message.SOAPBodyElement bodyelement = new
org.apache.axis.message.SOAPBodyElement(is);
            bodyelement.setNamespaceURI("http://example.org/services/Router5
");

            envelope.addBodyElement(bodyelement);
            org.apache.axis.message.SOAPEnvelope elms = (
org.apache.axis.message.SOAPEnvelope)call.invoke(envelope);
            org.apache.axis.message.SOAPBodyElement elem = elms.getFirstBody
();
            String str=elem.getAsString();
            System.err.print(str);


        }
        catch(SOAPException se){
            System.err.println("SOAPException: '" + se.getMessage() + "'");
            System.err.println("  Cause:  '" +
se.getCause().getClass().getName()
+ "': " + se.getCause().getMessage());
            return null;
        }
        catch (IOException ioe)
        {
          System.err.println("IOException writing SOAPMessage:  '" +
ioe.getMessage() + "'");
          return null;
        }
        catch(Exception e){
            e.printStackTrace();
        }

        return null;
 }


the exception posted in the server:

java.lang.NullPointerException
        at samples.AxisTest1.AxisTestSoapBindingImpl.getResourceProperty
(AxisTes
tSoapBindingImpl.java:488)
        at samples.AxisTest1.AxisTestSoapBindingSkeleton.getResourceProperty
(Axi
sTestSoapBindingSkeleton.java:389)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.apache.axis.providers.java.RPCProvider.invokeMethod(
RPCProvider.j
ava:397)
        at org.apache.axis.providers.java.RPCProvider.processMessage
(RPCProvider
.java:186)
        at org.apache.axis.providers.java.JavaProvider.invoke(
JavaProvider.java:
323)
        at org.apache.axis.strategies.InvocationStrategy.visit
(InvocationStrateg
y.java:32)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java
:454
)
        at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
        at org.apache.axis.transport.http.AxisServlet.doPost(
AxisServlet.java:69
9)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
        at org.apache.axis.transport.http.AxisServletBase.service
(AxisServletBas
e.java:327)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(Appl
icationFilterChain.java:200)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationF
ilterChain.java:146)
        at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperV
alve.java:209)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:948)

        at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextV
alve.java:144)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:948)

        at org.apache.catalina.core.StandardContext.invoke(
StandardContext.java:
2358)
        at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.j
ava:133)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatche
rValve.java:118)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:594)
        at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.j
ava:116)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:594)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:948)

        at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineVal
ve.java:127)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:948)

        at org.apache.coyote.tomcat4.CoyoteAdapter.service(
CoyoteAdapter.java:15
2)
        at org.apache.coyote.http11.Http11Processor.process(
Http11Processor.java
:799)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:705)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(
PoolTcpEndpoint.java
:577)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadP
ool.java:683)
        at java.lang.Thread.run(Thread.java:536)

Invoke a call to Muse in Axis

Posted by ZHAO <zh...@gmail.com>.
Hello,

I want to add identification function and maintain sessions in the Muse
service. Now I have deployed one Muse service and one Axis service. I invoke
a call to Muse service from Axis implemention file.(e.g. Once the Axis
service receives a GetResourceProperty soap request, it will do the
invocation to Muse service to get the required resource property.)
The following is the code of method getResourceProperty in the Axis
generated impl file. But it dose not work, it returns a NullPointer
Exception. I don't know where the problem is. Can anyone help?
Thanks in advance.
I attach as well the WSDL file,  the GetResourceProperty.soap and
GetResourceProperty.xml.

    public
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponsegetResourceProperty(
javax.xml.namespace.QName getResourcePropertyRequest) throws
java.rmi.RemoteException,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.InvalidResourcePropertyQNameFaultType,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.ResourceUnknownFaultType{

        try{
            String endpoint="http://localhost:8080/muse/services/router5";
            String uri = " http://example.org/services/Router5";
            InputStream is =ClassLoader.getSystemResourceAsStream
("C:/axis-1_4/samples/AxisTest1/requests/GetResourceProperty.xml");
            System.err.print ("input stream: "+is.toString());
            ServiceFactory sfactory = (org.apache.axis.client.ServiceFactory
)ServiceFactory.newInstance();

            URL wsdlURL = new
URL("http://localhost:8080/muse/services/router5?wsdl
");
            QName serviceQname = new QName("
http://example.org/services/Router5", "RouterService");
            Service service =
(org.apache.axis.client.Service)sfactory.createService(wsdlURL,
serviceQname);
            //the port name becomes the service name in the wsdd generated
by Wsdl2Java
            QName portQname = new QName("
http://example.org/services/Router5", "router5");


            Call call = (Call)service.createCall
(portQname,"GetResourceProperty");
            call.setTargetEndpointAddress(endpoint);
            call.setProperty(Call.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
            call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
            call.setProperty(Call.SOAPACTION_URI_PROPERTY, uri);

            call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY, "");
            call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
            call.setOperationName(new QName("
http://example.org/services/Router5","GetResourceProperty"));

            QName qn1=new QName("
http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl","GetResourceProperty");

//            QName qn2=new
QName("http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl
","GetResourcePropertyResponse");
            call.addParameter("ResourceId",qn1,ParameterMode.IN);
//            call.setReturnType(qn2,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponse.class);
//            QName qn3=new QName("http://example.org/services/Router5
","ResourceId");
//            String stri="ResourceId";
//            Object[] ob=(stri);
//
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponseres=(
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponse)call.invoke(qn3,ob);


            org.apache.axis.message.SOAPEnvelope envelope = new
org.apache.axis.message.SOAPEnvelope();
            org.apache.axis.message.SOAPBodyElement bodyelement = new
org.apache.axis.message.SOAPBodyElement(is);
            bodyelement.setNamespaceURI("http://example.org/services/Router5
");

            envelope.addBodyElement(bodyelement);
            org.apache.axis.message.SOAPEnvelope elms = (
org.apache.axis.message.SOAPEnvelope)call.invoke(envelope);
            org.apache.axis.message.SOAPBodyElement elem = elms.getFirstBody();
            String str=elem.getAsString();
            System.err.print(str);


        }
        catch(SOAPException se){
            System.err.println("SOAPException: '" + se.getMessage () + "'");
            System.err.println("  Cause:  '" +
se.getCause().getClass().getName()
+ "': " + se.getCause().getMessage());
            return null;
        }
        catch (IOException ioe)
        {
          System.err.println("IOException writing SOAPMessage:  '" +
ioe.getMessage() + "'");
          return null;
        }
        catch(Exception e){
            e.printStackTrace ();
        }

        return null;
 }


the WSDL definition:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="
http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="
http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:soapenc="
http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="
http://schemas.xmlsoap.org/wsdl/mime/" xmlns:wsrp="
http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.xsd"
xmlns:wsrpw="
http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl"
xmlns:wsntw="
http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.wsdl"
xmlns:muws-p2-wsdl="
http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.wsdl"
xmlns:tns="urn:AxisTest1" xmlns:typens="urn:AxisTest1"
targetNamespace="urn:AxisTest1" name="urn:AxisTest1">
    <import namespace="
http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl"
location="../spec/wsrf/WS-ResourceProperties-1_2-Draft_01.wsdl"/>
    <import namespace="
http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.wsdl"
location="../spec/wsn/WS-BaseNotification-1_2-Draft_01.wsdl"/>
    <import namespace="
http://docs.oasis-open.org/wsdm/2004/12/muws/wsdm-muws-part2.wsdl"
location="../spec/wsdm/MUWS-Part2-1_0.wsdl"/>
    <types>
        <xs:schema elementFormDefault="qualified"
targetNamespace="urn:AxisTest1" xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <!--element and type for login-->
            <xs:complexType name="UserType">
                <xs:sequence>
                    <xs:element name="username" type="xs:string"
minOccurs="1"/>
                    <xs:element name="password" type="xs:string"
minOccurs="1"/>
                    <xs:element name="profile" type="typens:ProfileType"
minOccurs="1"/>
                </xs:sequence>
            </xs:complexType>
            <xs:simpleType name="ProfileType">
                <xs:restriction base="xs:string">
                    <xs:enumeration value="administrator"/>
                    <xs:enumeration value="manager"/>
                    <xs:enumeration value="client"/>
                </xs:restriction>
            </xs:simpleType>
            <xs:simpleType name="IPAddressType">
                <xs:annotation>
                    <xs:documentation>An IP Address that matches the
following form:132.174.95.5</xs:documentation>
                </xs:annotation>
                <xs:restriction base="xs:string">
                    <xs:pattern
value="[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"/>
                </xs:restriction>
            </xs:simpleType>
            <xs:complexType name="RouteType">
                <xs:sequence>
                    <xs:element name="destinationAddress"
type="tns:IPAddressType"/>
                    <xs:element name="forwardingAddress"
type="tns:IPAddressType"/>
                </xs:sequence>
            </xs:complexType>
            <!-- message types for custom operations    -->
            <xs:element name="Login">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="username" type="xs:string"/>
                        <xs:element name="password" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="LoginResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="username" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="Logout">
                <xs:complexType/>
            </xs:element>
            <xs:element name="LogoutResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="logoutoutput" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="AddUser">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="username" type="xs:string"/>
                        <xs:element name="password" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="AddUserResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="adduseroutput"
type="typens:UserType"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="DeleteUser">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="username" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="DeleteUserResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="deleteuseroutput"
type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="QueryUsers">
                <xs:complexType/>
            </xs:element>
            <xs:element name="QueryUsersResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="users" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="AddRoute">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="destination" type="xs:string"/>
                        <xs:element name="forwarding" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="AddRouteResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="addrouteoutput"
type="typens:RouteType"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="DeleteRoute">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="route" type="typens:RouteType"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="DeleteRouteResponse">
                <xs:complexType/>
            </xs:element>
            <xs:element name="QueryRoutes">
                <xs:complexType/>
            </xs:element>
            <xs:element name="QueryRoutesResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="routes" type="xs:string"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>
    </types>
    <message name="LoginRequest">
        <part name="LoginRequest" element="tns:Login"/>
    </message>
    <message name="LoginResponse">
        <part name="LoginResponse" element="tns:LoginResponse"/>
    </message>
    <message name="LogoutRequest">
        <part name="LogoutRequest" element="tns:Logout"/>
    </message>
    <message name="LogoutResponse">
        <part name="LogoutResponse" element="tns:LogoutResponse"/>
    </message>
    <message name="AddUserRequest">
        <part name="AddUserRequest" element="tns:AddUser"/>
    </message>
    <message name="AddUserResponse">
        <part name="AddUserResponse" element="tns:AddUserResponse"/>
    </message>
    <message name="DeleteUserRequest">
        <part name="DeleteUserRequest" element="tns:DeleteUser"/>
    </message>
    <message name="DeleteUserResponse">
        <part name="DeleteUserResponse" element="tns:DeleteUserResponse"/>
    </message>
    <message name="QueryUsersRequest">
        <part name="QueryUsersRequest" element="tns:QueryUsers"/>
    </message>
    <message name="QueryUsersResponse">
        <part name="QueryUsersResponse" element="tns:QueryUsersResponse"/>
    </message>
    <message name="AddRouteRequest">
        <part name="AddRouteRequest" element="tns:AddRoute"/>
    </message>
    <message name="AddRouteResponse">
        <part name="AddRouteResponse" element="tns:AddRouteResponse"/>
    </message>
    <message name="DeleteRouteRequest">
        <part name="DeleteRouteRequest" element="tns:DeleteRoute"/>
    </message>
    <message name="DeleteRouteResponse">
        <part name="DeleteRouteResponse" element="tns:DeleteRouteResponse"/>
    </message>
    <message name="QueryRoutesRequest">
        <part name="QueryRoutesRequest" element="tns:QueryRoutes"/>
    </message>
    <message name="QueryRoutesResponse">
        <part name="QueryRoutesResponse" element="tns:QueryRoutesResponse"/>
    </message>
    <portType name="AxisTest1">
        <operation name="Login">
            <input message="tns:LoginRequest"/>
            <output message="tns:LoginResponse"/>
        </operation>
        <operation name="Logout">
            <input message="tns:LogoutRequest"/>
            <output message="tns:LogoutResponse"/>
        </operation>
        <operation name="AddUser">
            <input message="tns:AddUserRequest"/>
            <output message="tns:AddUserResponse"/>
        </operation>
        <operation name="DeleteUser">
            <input message="tns:DeleteUserRequest"/>
            <output message="tns:DeleteUserResponse"/>
        </operation>
        <operation name="QueryUsers">
            <input message="tns:QueryUsersRequest"/>
            <output message="tns:QueryUsersResponse"/>
        </operation>
        <operation name="AddRoute">
            <input message="tns:AddRouteRequest"/>
            <output message="tns:AddRouteResponse"/>
        </operation>
        <operation name="DeleteRoute">
            <input message="tns:DeleteRouteRequest"/>
            <output message="tns:DeleteRouteResponse"/>
        </operation>
        <operation name="QueryRoutes">
            <input message="tns:QueryRoutesResponse"/>
            <output message="tns:QueryRoutesResponse"/>
        </operation>
        <!-- wsrpw:* operations -->
        <operation name="GetResourceProperty">
            <input name="GetResourcePropertyRequest"
message="wsrpw:GetResourcePropertyRequest"/>
            <output name="GetResourcePropertyResponse"
message="wsrpw:GetResourcePropertyResponse"/>
            <fault name="ResourceUnknownFault"
message="wsrpw:ResourceUnknownFault"/>
            <fault name="InvalidResourcePropertyQNameFault"
message="wsrpw:InvalidResourcePropertyQNameFault"/>
        </operation>
        <operation name="GetMultipleResourceProperties">
            <input name="GetMultipleResourcePropertiesRequest"
message="wsrpw:GetMultipleResourcePropertiesRequest"/>
            <output name="GetMultipleResourcePropertiesResponse"
message="wsrpw:GetMultipleResourcePropertiesResponse"/>
            <fault name="ResourceUnknownFault"
message="wsrpw:ResourceUnknownFault"/>
            <fault name="InvalidResourcePropertyQNameFault"
message="wsrpw:InvalidResourcePropertyQNameFault"/>
        </operation>
        <operation name="SetResourceProperties">
            <input name="SetResourcePropertiesRequest"
message="wsrpw:SetResourcePropertiesRequest"/>
            <output name="SetResourcePropertiesResponse"
message="wsrpw:SetResourcePropertiesResponse"/>
            <fault name="ResourceUnknownFault"
message="wsrpw:ResourceUnknownFault"/>
            <fault name="InvalidResourcePropertyQNameFault"
message="wsrpw:InvalidResourcePropertyQNameFault"/>
            <fault name="InvalidSetResourcePropertiesRequestContentFault"
message="wsrpw:InvalidSetResourcePropertiesRequestContentFault"/>
            <fault name="UnableToModifyResourcePropertyFault"
message="wsrpw:UnableToModifyResourcePropertyFault"/>
            <fault name="SetResourcePropertyRequestFailedFault"
message="wsrpw:SetResourcePropertyRequestFailedFault"/>
        </operation>
        <operation name="QueryResourceProperties">
            <input name="QueryResourcePropertiesRequest"
message="wsrpw:QueryResourcePropertiesRequest"/>
            <output name="QueryResourcePropertiesResponse"
message="wsrpw:QueryResourcePropertiesResponse"/>
            <fault name="ResourceUnknownFault"
message="wsrpw:ResourceUnknownFault"/>
            <fault name="InvalidResourcePropertyQNameFault"
message="wsrpw:InvalidResourcePropertyQNameFault"/>
            <fault name="UnknownQueryExpressionDialectFault"
message="wsrpw:UnknownQueryExpressionDialectFault"/>
            <fault name="InvalidQueryExpressionFault"
message="wsrpw:InvalidQueryExpressionFault"/>
            <fault name="QueryEvaluationErrorFault"
message="wsrpw:QueryEvaluationErrorFault"/>
        </operation>
        <!-- wsntw:NotificationProducer operations -->
        <operation name="Subscribe">
            <input message="wsntw:SubscribeRequest"/>
            <output message="wsntw:SubscribeResponse"/>
            <fault name="ResourceUnknownFault"
message="wsntw:ResourceUnknownFault"/>
            <fault name="SubscribeCreationFailedFault"
message="wsntw:SubscribeCreationFailedFault"/>
            <fault name="TopicPathDialectUnknownFault"
message="wsntw:TopicPathDialectUnknownFault"/>
        </operation>
        <operation name="GetCurrentMessage">
            <input message="wsntw:GetCurrentMessageRequest"/>
            <output message="wsntw:GetCurrentMessageResponse"/>
            <fault name="ResourceUnknownFault"
message="wsntw:ResourceUnknownFault"/>
            <fault name="InvalidTopicExpressionFault"
message="wsntw:InvalidTopicExpressionFault"/>
            <fault name="TopicNotSupportedFault"
message="wsntw:TopicNotSupportedFault"/>
            <fault name="NoCurrentMessageOnTopicFault"
message="wsntw:NoCurrentMessageOnTopicFault"/>
        </operation>
    </portType>
    <binding name="AxisTestSoapBinding" type="tns:AxisTest1">
        <soap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
        <operation name="Login">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
        <operation name="Logout">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
        <operation name="AddUser">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
        <operation name="DeleteUser">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
        <operation name="QueryUsers">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
        <operation name="AddRoute">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
        <operation name="DeleteRoute">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
        <operation name="QueryRoutes">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
        </operation>
        <!-- wsrpw:* operations -->
        <operation name="GetResourceProperty">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="ResourceUnknownFault">
                <soap:fault name="ResourceUnknownFault" use="literal"/>
            </fault>
            <fault name="InvalidResourcePropertyQNameFault">
                <soap:fault name="InvalidResourcePropertyQNameFault"
use="literal"/>
            </fault>
        </operation>
        <operation name="GetMultipleResourceProperties">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="ResourceUnknownFault">
                <soap:fault name="ResourceUnknownFault" use="literal"/>
            </fault>
            <fault name="InvalidResourcePropertyQNameFault">
                <soap:fault name="InvalidResourcePropertyQNameFault"
use="literal"/>
            </fault>
        </operation>
        <operation name="SetResourceProperties">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="ResourceUnknownFault">
                <soap:fault name="ResourceUnknownFault" use="literal"/>
            </fault>
            <fault name="InvalidResourcePropertyQNameFault">
                <soap:fault name="InvalidResourcePropertyQNameFault"
use="literal"/>
            </fault>
            <fault name="UnableToModifyResourcePropertyFault">
                <soap:fault name="UnableToModifyResourcePropertyFault"
use="literal"/>
            </fault>
            <fault name="InvalidSetResourcePropertiesRequestContentFault">
                <soap:fault
name="InvalidSetResourcePropertiesRequestContentFault" use="literal"/>
            </fault>
            <fault name="SetResourcePropertyRequestFailedFault">
                <soap:fault name="SetResourcePropertyRequestFailedFault"
use="literal"/>
            </fault>
        </operation>
        <operation name="QueryResourceProperties">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="ResourceUnknownFault">
                <soap:fault name="ResourceUnknownFault" use="literal"/>
            </fault>
            <fault name="InvalidResourcePropertyQNameFault">
                <soap:fault name="InvalidResourcePropertyQNameFault"
use="literal"/>
            </fault>
            <fault name="UnknownQueryExpressionDialectFault">
                <soap:fault name="UnknownQueryExpressionDialectFault"
use="literal"/>
            </fault>
            <fault name="InvalidQueryExpressionFault">
                <soap:fault name="InvalidQueryExpressionFault"
use="literal"/>
            </fault>
            <fault name="QueryEvaluationErrorFault">
                <soap:fault name="QueryEvaluationErrorFault" use="literal"/>
            </fault>
        </operation>
        <!-- wsntw:NotificationProducer operations -->
        <operation name="Subscribe">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="ResourceUnknownFault">
                <soap:fault name="ResourceUnknownFault" use="literal"/>
            </fault>
            <fault name="SubscribeCreationFailedFault">
                <soap:fault name="SubscribeCreationFailedFault"
use="literal"/>
            </fault>
            <fault name="TopicPathDialectUnknownFault">
                <soap:fault name="TopicPathDialectUnknownFault"
use="literal"/>
            </fault>
        </operation>
        <operation name="GetCurrentMessage">
            <soap:operation soapAction="
http://localhost:8080/axis/services/AxisTest1" style="document"/>
            <input>
                <soap:body use="literal"/>
            </input>
            <output>
                <soap:body use="literal"/>
            </output>
            <fault name="ResourceUnknownFault">
                <soap:fault name="ResourceUnknownFault" use="literal"/>
            </fault>
            <fault name="InvalidTopicExpressionFault">
                <soap:fault name="InvalidTopicExpressionFault"
use="literal"/>
            </fault>
            <fault name="TopicNotSupportedFault">
                <soap:fault name="TopicNotSupportedFault" use="literal"/>
            </fault>
            <fault name="NoCurrentMessageOnTopicFault">
                <soap:fault name="NoCurrentMessageOnTopicFault"
use="literal"/>
            </fault>
        </operation>
    </binding>
    <service name="AxisTest1">
        <port name="AxisTest1" binding="tns:AxisTestSoapBinding">
            <soap:address location="
http://localhost:8080/axis/services/AxisTest1"/>
        </port>
    </service>
    <!--messages for login-->
</definitions>



the exception posted in the server:

java.lang.NullPointerException
        at samples.AxisTest1.AxisTestSoapBindingImpl.getResourceProperty(AxisTes

tSoapBindingImpl.java:488)
        at samples.AxisTest1.AxisTestSoapBindingSkeleton.getResourceProperty
(Axi
sTestSoapBindingSkeleton.java:389)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke (Method.java:324)
        at org.apache.axis.providers.java.RPCProvider.invokeMethod(
RPCProvider.j
ava:397)
        at org.apache.axis.providers.java.RPCProvider.processMessage
(RPCProvider
.java:186)
        at org.apache.axis.providers.java.JavaProvider.invoke(
JavaProvider.java:
323)
        at org.apache.axis.strategies.InvocationStrategy.visit
(InvocationStrateg
y.java:32)
        at org.apache.axis.SimpleChain.doVisiting (SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java
:454
)
        at org.apache.axis.server.AxisServer.invoke (AxisServer.java:281)
        at org.apache.axis.transport.http.AxisServlet.doPost(
AxisServlet.java:69
9)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
        at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBas
e.java:327)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(Appl
icationFilterChain.java:200)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationF
ilterChain.java:146)
        at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperV
alve.java:209)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:948)

        at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextV
alve.java:144)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)


        at org.apache.catalina.core.StandardContext.invoke(
StandardContext.java:
2358)
        at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.j
ava:133)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatche
rValve.java:118)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:594)
        at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.j
ava:116)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:594)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)


        at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineVal
ve.java:127)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java :596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:948)

        at org.apache.coyote.tomcat4.CoyoteAdapter.service (
CoyoteAdapter.java:15
2)
        at org.apache.coyote.http11.Http11Processor.process(
Http11Processor.java
:799)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection( Http11Protocol.java:705)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(
PoolTcpEndpoint.java
:577)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadP
ool.java:683)
        at java.lang.Thread.run(Thread.java:536)

Invoke a call to Muse in Axis

Posted by ZHAO <zh...@gmail.com>.
Hello,

I want to add identification function and maintain sessions in the Muse
service. Now I have deployed one Muse service and one Axis service. I invoke
a call to Muse service from Axis implemention file.(e.g. Once the Axis
service receives a GetResourceProperty soap request, it will do the
invocation to Muse service to get the required resource property.)
The following is the code of method getResourceProperty in the Axis
generated impl file. But it dose not work, it returns a NullPointer
Exception. I don't know where the problem is. Can anyone help?
Thanks in advance.
I attach as well the WSDL file,  the GetResourceProperty.soap and
GetResourceProperty.xml.

    public
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponsegetResourceProperty(
javax.xml.namespace.QName getResourcePropertyRequest) throws
java.rmi.RemoteException,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.InvalidResourcePropertyQNameFaultType,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.ResourceUnknownFaultType{

        try{
            String endpoint="http://localhost:8080/muse/services/router5";
            String uri = " http://example.org/services/Router5";
            InputStream is =ClassLoader.getSystemResourceAsStream
("C:/axis-1_4/samples/AxisTest1/requests/GetResourceProperty.xml");
            System.err.print ("input stream: "+is.toString());
            ServiceFactory sfactory = (org.apache.axis.client.ServiceFactory
)ServiceFactory.newInstance();

            URL wsdlURL = new
URL("http://localhost:8080/muse/services/router5?wsdl
");
            QName serviceQname = new QName("
http://example.org/services/Router5", "RouterService");
            Service service =
(org.apache.axis.client.Service)sfactory.createService(wsdlURL,
serviceQname);
            //the port name becomes the service name in the wsdd generated
by Wsdl2Java
            QName portQname = new QName("
http://example.org/services/Router5", "router5");


            Call call = (Call)service.createCall
(portQname,"GetResourceProperty");
            call.setTargetEndpointAddress(endpoint);
            call.setProperty(Call.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
            call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
            call.setProperty(Call.SOAPACTION_URI_PROPERTY, uri);

            call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY, "");
            call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
            call.setOperationName(new QName("
http://example.org/services/Router5","GetResourceProperty"));

            QName qn1=new QName("
http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl","GetResourceProperty");

//            QName qn2=new
QName("http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl
","GetResourcePropertyResponse");
            call.addParameter("ResourceId",qn1,ParameterMode.IN);
//            call.setReturnType(qn2,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponse.class);
//            QName qn3=new QName("http://example.org/services/Router5
","ResourceId");
//            String stri="ResourceId";
//            Object[] ob=(stri);
//
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponseres=(
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponse)call.invoke(qn3,ob);


            org.apache.axis.message.SOAPEnvelope envelope = new
org.apache.axis.message.SOAPEnvelope();
            org.apache.axis.message.SOAPBodyElement bodyelement = new
org.apache.axis.message.SOAPBodyElement(is);
            bodyelement.setNamespaceURI("http://example.org/services/Router5
");

            envelope.addBodyElement(bodyelement);
            org.apache.axis.message.SOAPEnvelope elms = (
org.apache.axis.message.SOAPEnvelope)call.invoke(envelope);
            org.apache.axis.message.SOAPBodyElement elem = elms.getFirstBody();
            String str=elem.getAsString();
            System.err.print(str);


        }
        catch(SOAPException se){
            System.err.println("SOAPException: '" + se.getMessage () + "'");
            System.err.println("  Cause:  '" +
se.getCause().getClass().getName()
+ "': " + se.getCause().getMessage());
            return null;
        }
        catch (IOException ioe)
        {
          System.err.println("IOException writing SOAPMessage:  '" +
ioe.getMessage() + "'");
          return null;
        }
        catch(Exception e){
            e.printStackTrace ();
        }

        return null;
 }


the exception posted in the server:

java.lang.NullPointerException
        at samples.AxisTest1.AxisTestSoapBindingImpl.getResourceProperty(AxisTes

tSoapBindingImpl.java:488)
        at samples.AxisTest1.AxisTestSoapBindingSkeleton.getResourceProperty
(Axi
sTestSoapBindingSkeleton.java:389)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke (Method.java:324)
        at org.apache.axis.providers.java.RPCProvider.invokeMethod(
RPCProvider.j
ava:397)
        at org.apache.axis.providers.java.RPCProvider.processMessage
(RPCProvider
.java:186)
        at org.apache.axis.providers.java.JavaProvider.invoke(
JavaProvider.java:
323)
        at org.apache.axis.strategies.InvocationStrategy.visit
(InvocationStrateg
y.java:32)
        at org.apache.axis.SimpleChain.doVisiting (SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java
:454
)
        at org.apache.axis.server.AxisServer.invoke (AxisServer.java:281)
        at org.apache.axis.transport.http.AxisServlet.doPost(
AxisServlet.java:69
9)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
        at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBas
e.java:327)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(Appl
icationFilterChain.java:200)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationF
ilterChain.java:146)
        at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperV
alve.java:209)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:948)

        at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextV
alve.java:144)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)


        at org.apache.catalina.core.StandardContext.invoke(
StandardContext.java:
2358)
        at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.j
ava:133)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatche
rValve.java:118)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:594)
        at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.j
ava:116)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:594)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)


        at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineVal
ve.java:127)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java :596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:948)

        at org.apache.coyote.tomcat4.CoyoteAdapter.service (
CoyoteAdapter.java:15
2)
        at org.apache.coyote.http11.Http11Processor.process(
Http11Processor.java
:799)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection( Http11Protocol.java:705)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(
PoolTcpEndpoint.java
:577)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadP
ool.java:683)
        at java.lang.Thread.run(Thread.java:536)

Invoke a call to Muse in Axis

Posted by ZHAO <zh...@gmail.com>.
Hello,

I want to add identification function and maintain sessions in the Muse
service. Now I have deployed one Muse service and one Axis service. I invoke
a call to Muse service from Axis implemention file.(e.g. Once the Axis
service receives a GetResourceProperty soap request, it will do the
invocation to Muse service to get the required resource property.)
The following is the code of method getResourceProperty in the Axis
generated impl file. But it dose not work, it returns a NullPointer
Exception. I don't know where the problem is. Can anyone help?
Thanks in advance.
I attach as well the WSDL file,  the GetResourceProperty.soap and
GetResourceProperty.xml.

    public
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponsegetResourceProperty(
javax.xml.namespace.QName getResourcePropertyRequest) throws
java.rmi.RemoteException,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.InvalidResourcePropertyQNameFaultType,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.ResourceUnknownFaultType{

        try{
            String endpoint="http://localhost:8080/muse/services/router5";
            String uri = " http://example.org/services/Router5";
            InputStream is =ClassLoader.getSystemResourceAsStream
("C:/axis-1_4/samples/AxisTest1/requests/GetResourceProperty.xml");
            System.err.print ("input stream: "+is.toString());
            ServiceFactory sfactory = (org.apache.axis.client.ServiceFactory
)ServiceFactory.newInstance();

            URL wsdlURL = new
URL("http://localhost:8080/muse/services/router5?wsdl
");
            QName serviceQname = new QName("
http://example.org/services/Router5", "RouterService");
            Service service =
(org.apache.axis.client.Service)sfactory.createService(wsdlURL,
serviceQname);
            //the port name becomes the service name in the wsdd generated
by Wsdl2Java
            QName portQname = new QName("
http://example.org/services/Router5", "router5");


            Call call = (Call)service.createCall
(portQname,"GetResourceProperty");
            call.setTargetEndpointAddress(endpoint);
            call.setProperty(Call.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
            call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
            call.setProperty(Call.SOAPACTION_URI_PROPERTY, uri);

            call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY, "");
            call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
            call.setOperationName(new QName("
http://example.org/services/Router5","GetResourceProperty"));

            QName qn1=new QName("
http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl","GetResourceProperty");

//            QName qn2=new
QName("http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl
","GetResourcePropertyResponse");
            call.addParameter("ResourceId",qn1,ParameterMode.IN);
//            call.setReturnType(qn2,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponse.class);
//            QName qn3=new QName("http://example.org/services/Router5
","ResourceId");
//            String stri="ResourceId";
//            Object[] ob=(stri);
//
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponseres=(
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponse)call.invoke(qn3,ob);


            org.apache.axis.message.SOAPEnvelope envelope = new
org.apache.axis.message.SOAPEnvelope();
            org.apache.axis.message.SOAPBodyElement bodyelement = new
org.apache.axis.message.SOAPBodyElement(is);
            bodyelement.setNamespaceURI("http://example.org/services/Router5
");

            envelope.addBodyElement(bodyelement);
            org.apache.axis.message.SOAPEnvelope elms = (
org.apache.axis.message.SOAPEnvelope)call.invoke(envelope);
            org.apache.axis.message.SOAPBodyElement elem = elms.getFirstBody();
            String str=elem.getAsString();
            System.err.print(str);


        }
        catch(SOAPException se){
            System.err.println("SOAPException: '" + se.getMessage () + "'");
            System.err.println("  Cause:  '" +
se.getCause().getClass().getName()
+ "': " + se.getCause().getMessage());
            return null;
        }
        catch (IOException ioe)
        {
          System.err.println("IOException writing SOAPMessage:  '" +
ioe.getMessage() + "'");
          return null;
        }
        catch(Exception e){
            e.printStackTrace ();
        }

        return null;
 }


the exception posted in the server:

java.lang.NullPointerException
        at samples.AxisTest1.AxisTestSoapBindingImpl.getResourceProperty(AxisTes

tSoapBindingImpl.java:488)
        at samples.AxisTest1.AxisTestSoapBindingSkeleton.getResourceProperty
(Axi
sTestSoapBindingSkeleton.java:389)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke (Method.java:324)
        at org.apache.axis.providers.java.RPCProvider.invokeMethod(
RPCProvider.j
ava:397)
        at org.apache.axis.providers.java.RPCProvider.processMessage
(RPCProvider
.java:186)
        at org.apache.axis.providers.java.JavaProvider.invoke(
JavaProvider.java:
323)
        at org.apache.axis.strategies.InvocationStrategy.visit
(InvocationStrateg
y.java:32)
        at org.apache.axis.SimpleChain.doVisiting (SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java
:454
)
        at org.apache.axis.server.AxisServer.invoke (AxisServer.java:281)
        at org.apache.axis.transport.http.AxisServlet.doPost(
AxisServlet.java:69
9)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
        at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBas
e.java:327)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(Appl
icationFilterChain.java:200)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationF
ilterChain.java:146)
        at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperV
alve.java:209)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:948)

        at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextV
alve.java:144)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)


        at org.apache.catalina.core.StandardContext.invoke(
StandardContext.java:
2358)
        at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.j
ava:133)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatche
rValve.java:118)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:594)
        at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.j
ava:116)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:594)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)


        at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineVal
ve.java:127)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java :596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:948)

        at org.apache.coyote.tomcat4.CoyoteAdapter.service (
CoyoteAdapter.java:15
2)
        at org.apache.coyote.http11.Http11Processor.process(
Http11Processor.java
:799)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection( Http11Protocol.java:705)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(
PoolTcpEndpoint.java
:577)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadP
ool.java:683)
        at java.lang.Thread.run(Thread.java:536)

Invoke a call to Muse in Axis

Posted by ZHAO <zh...@gmail.com>.
Hello,

I want to add identification function and maintain sessions in the Muse
service. Now I have deployed one Muse service and one Axis service. I invoke
a call to Muse service from Axis implemention file.(e.g. Once the Axis
service receives a GetResourceProperty soap request, it will do the
invocation to Muse service to get the required resource property.)
The following is the code of method getResourceProperty in the Axis
generated impl file. But it dose not work, it returns a NullPointer
Exception. I don't know where the problem is. Can anyone help?
Thanks in advance.
I attach as well the WSDL file,  the GetResourceProperty.soap and
GetResourceProperty.xml.

    public
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponsegetResourceProperty(
javax.xml.namespace.QName getResourcePropertyRequest) throws
java.rmi.RemoteException,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.InvalidResourcePropertyQNameFaultType,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.ResourceUnknownFaultType{

        try{
            String endpoint="http://localhost:8080/muse/services/router5";
            String uri = " http://example.org/services/Router5";
            InputStream is =ClassLoader.getSystemResourceAsStream
("C:/axis-1_4/samples/AxisTest1/requests/GetResourceProperty.xml");
            System.err.print ("input stream: "+is.toString());
            ServiceFactory sfactory = (org.apache.axis.client.ServiceFactory
)ServiceFactory.newInstance();

            URL wsdlURL = new
URL("http://localhost:8080/muse/services/router5?wsdl
");
            QName serviceQname = new QName("
http://example.org/services/Router5", "RouterService");
            Service service =
(org.apache.axis.client.Service)sfactory.createService(wsdlURL,
serviceQname);
            //the port name becomes the service name in the wsdd generated
by Wsdl2Java
            QName portQname = new QName("
http://example.org/services/Router5", "router5");


            Call call = (Call)service.createCall
(portQname,"GetResourceProperty");
            call.setTargetEndpointAddress(endpoint);
            call.setProperty(Call.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
            call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
            call.setProperty(Call.SOAPACTION_URI_PROPERTY, uri);

            call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY, "");
            call.setProperty(Call.OPERATION_STYLE_PROPERTY, "document");
            call.setOperationName(new QName("
http://example.org/services/Router5","GetResourceProperty"));

            QName qn1=new QName("
http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl","GetResourceProperty");

//            QName qn2=new
QName("http://docs.oasis-open.org/wsrf/2004/06/wsrf-WS-ResourceProperties-1.2-draft-01.wsdl
","GetResourcePropertyResponse");
            call.addParameter("ResourceId",qn1,ParameterMode.IN);
//            call.setReturnType(qn2,
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponse.class);
//            QName qn3=new QName("http://example.org/services/Router5
","ResourceId");
//            String stri="ResourceId";
//            Object[] ob=(stri);
//
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponseres=(
org.oasis_open.docs.wsrf._2004._06.wsrf_WS_ResourceProperties_1_2_draft_01_xsd.GetResourcePropertyResponse)call.invoke(qn3,ob);


            org.apache.axis.message.SOAPEnvelope envelope = new
org.apache.axis.message.SOAPEnvelope();
            org.apache.axis.message.SOAPBodyElement bodyelement = new
org.apache.axis.message.SOAPBodyElement(is);
            bodyelement.setNamespaceURI("http://example.org/services/Router5
");

            envelope.addBodyElement(bodyelement);
            org.apache.axis.message.SOAPEnvelope elms = (
org.apache.axis.message.SOAPEnvelope)call.invoke(envelope);
            org.apache.axis.message.SOAPBodyElement elem = elms.getFirstBody();
            String str=elem.getAsString();
            System.err.print(str);


        }
        catch(SOAPException se){
            System.err.println("SOAPException: '" + se.getMessage () + "'");
            System.err.println("  Cause:  '" +
se.getCause().getClass().getName()
+ "': " + se.getCause().getMessage());
            return null;
        }
        catch (IOException ioe)
        {
          System.err.println("IOException writing SOAPMessage:  '" +
ioe.getMessage() + "'");
          return null;
        }
        catch(Exception e){
            e.printStackTrace ();
        }

        return null;
 }


the exception posted in the server:

java.lang.NullPointerException
        at samples.AxisTest1.AxisTestSoapBindingImpl.getResourceProperty(AxisTes

tSoapBindingImpl.java:488)
        at samples.AxisTest1.AxisTestSoapBindingSkeleton.getResourceProperty
(Axi
sTestSoapBindingSkeleton.java:389)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke (Method.java:324)
        at org.apache.axis.providers.java.RPCProvider.invokeMethod(
RPCProvider.j
ava:397)
        at org.apache.axis.providers.java.RPCProvider.processMessage
(RPCProvider
.java:186)
        at org.apache.axis.providers.java.JavaProvider.invoke(
JavaProvider.java:
323)
        at org.apache.axis.strategies.InvocationStrategy.visit
(InvocationStrateg
y.java:32)
        at org.apache.axis.SimpleChain.doVisiting (SimpleChain.java:118)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
        at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java
:454
)
        at org.apache.axis.server.AxisServer.invoke (AxisServer.java:281)
        at org.apache.axis.transport.http.AxisServlet.doPost(
AxisServlet.java:69
9)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
        at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBas
e.java:327)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(Appl
icationFilterChain.java:200)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationF
ilterChain.java:146)
        at org.apache.catalina.core.StandardWrapperValve.invoke
(StandardWrapperV
alve.java:209)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:948)

        at org.apache.catalina.core.StandardContextValve.invoke
(StandardContextV
alve.java:144)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)


        at org.apache.catalina.core.StandardContext.invoke(
StandardContext.java:
2358)
        at org.apache.catalina.core.StandardHostValve.invoke(
StandardHostValve.j
ava:133)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:596)
        at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatche
rValve.java:118)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:594)
        at org.apache.catalina.valves.ErrorReportValve.invoke(
ErrorReportValve.j
ava:116)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java:594)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)


        at org.apache.catalina.core.StandardEngineValve.invoke
(StandardEngineVal
ve.java:127)
        at
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContex
t.invokeNext(StandardPipeline.java :596)
        at org.apache.catalina.core.StandardPipeline.invoke(
StandardPipeline.jav
a:433)
        at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java
:948)

        at org.apache.coyote.tomcat4.CoyoteAdapter.service (
CoyoteAdapter.java:15
2)
        at org.apache.coyote.http11.Http11Processor.process(
Http11Processor.java
:799)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection( Http11Protocol.java:705)
        at org.apache.tomcat.util.net.TcpWorkerThread.runIt(
PoolTcpEndpoint.java
:577)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadP
ool.java:683)
        at java.lang.Thread.run(Thread.java:536)