axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Robinson" <robin...@gaaoc.us>
Subject RE: [Axis2] How to specifiy operation name
Date Tue, 14 Mar 2006 16:18:56 GMT
My main problem is that depending on the XML instance that I read in and send I sometimes get:


 

org.apache.axis2.AxisFault: org.apache.axis2.AxisFault: Operation Not found EPR is http://127.0.0.1:8080/axis2/services/DocumentServiceX
and WSA Action = 

            at org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java:46)

            at org.apache.axis2.engine.Phase.invoke(Phase.java:391)

            at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:351)

            at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:322)

            at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:274)

            at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:150)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)

            at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

 

Which seems to depend on the root node of the XML instance. If I send in something like: 

 

 <?xml version = '1.0' encoding = 'UTF-8'?>

<childSupportEnforcementFiling> 

  <js:ChildSupportPackage xmlns:js="http://schema.gaaoc.us/body/ga/washington/document/cse/extension">

            <j:Case xmlns:j="http://www.it.ojp.gov/jxdm/3.0.2">

                        ….

Everything works fine and the operation name childSupportEnforcementFiling is invoked. But
if I send: 

 

<?xml version = '1.0' encoding = 'UTF-8'?>

<ChildSupportEnforcementFiling> 

  <js:ChildSupportPackage xmlns:js="http://schema.gaaoc.us/body/ga/washington/document/cse/extension">

            <j:Case xmlns:j="http://www.it.ojp.gov/jxdm/3.0.2">

                        ….

I get the exception mentioned above. The same for if I send in something like: 

 

<?xml version = '1.0' encoding = 'UTF-8'?>

<ChildSupportEnforcementFiling xmlns="http://schema.gaaoc.us/body/ga/washington/document/cse/document-schema.xsd"
schemaLocation="http://schema.gaaoc.us/body/ga/washington/document/cse/document-schema.xsd

http://schema.gaaoc.us/body/ga/washington/document/cse/document-schema.xsd" >

  <js:ChildSupportPackage xmlns:js="http://schema.gaaoc.us/body/ga/washington/document/cse/extension">

            <j:Case xmlns:j="http://www.it.ojp.gov/jxdm/3.0.2">

                        ….

 

Which is where I am trying to get to.

 

 

Also here is my services.xml: 

 

<service name="MTOMService">

    <description>

        Web Service for receiving Child Support Enforcement filing(s) w/ 

        MTOM based binary data transfer.

    </description>

    <parameter name="ServiceClass" locked="false">us.gaaoc.service.MTOMService</parameter>

    <operation name="childSupportEnforcementFiling">

        <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/>

    </operation>

</service>

 

 

 

 

________________________________

From: Michael Robinson [mailto:robinsom@gaaoc.us] 
Sent: Tuesday, March 14, 2006 10:42 AM
To: axis-user@ws.apache.org
Subject: [Axis2] How to specifiy operation name

 

I am attempting to create both the service and client for a document centric web service with
each exchange based on a XML Schema instance.

 

I have taken the MTOM examples (mostly the imagetransfer example) and am trying to from the
client load an XML instance (instead of a jpeg) and then call the service passing the instance
as the SOAP body element. I have this working…. sortof. In the examples the root element
of the XML within the SOAP body matches the operation name so the client finds the operation
and everything is great! Is this the default behavior? It seems that some of the examples
declare a QName but then never use the variable to set the desired operation which increases
my confusion. 

 

How do I specify the remote operation? I have noticed some of the examples using objects of
AxisService and OperationClient. Is this what I am looking for? I didn’t see anything in
the documentation thus far that talks about specifying the remote operation from the client.
Did I miss it? 

 

Is there an example which deals with XML instances? Would it be correct to assume that a WSDL
to go with this type of exchange will need a lot of hand tuning from what the engine generates
by default? I have looked for examples that exchange xml instances w/ relevant schemas w/
more customized WSDL but have not been successful in finding any. 

 

Just in case it might help here are the relevant pieces of my project: (let me know if I forgot
any)

 

Relevant Client code: 

 

public OMElement sendFile(String fileName) throws Exception {

                        OMElement payload = createEnvelope(fileName);

                        

                        Options options = new Options();

                        options.setSoapVersionURI(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI);

                        options.setTo(targetEPR);

                        

                        // enabling MTOM in the client side

                        options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);

                        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);

 

                        

                        ServiceClient sender = new ServiceClient();

                        sender.setOptions(options);

                        return sender.sendReceive(payload);

}

 

private OMElement createEnvelope(String fileName) throws Exception {

 

// create the parser 

                        XMLStreamReader parser = XMLInputFactory.newInstance().createXMLStreamReader(new
FileReader(inputFile));

 

                        // create the builder

                        OMXMLParserWrapper builder = OMXMLBuilderFactory.createStAXOMBuilder(OMAbstractFactory.getOMFactory(),
parser);

 

                        OMElement xmlDocElement = builder.getDocumentElement();

                        return xmlDocElement;

}

 

Relevant Service code: 

 

            public OMElement childSupportEnforcementFiling(OMElement element) throws Exception
{

 

                        OMXMLParserWrapper builder = element.getBuilder();

 

                        QName soapHeaderQName = new QName("http://schemas.xmlsoap.org/soap/envelope/",
"Header");

                        SOAPEnvelope envelope = (SOAPEnvelope) builder.getDocumentElement();

                        SOAPHeader soapHeader = envelope.getHeader();

 

                        Iterator headerIterator = soapHeader.getChildElements();

 

                        while (headerIterator.hasNext()) {

                                    SOAPHeaderBlock soapHeaderBlock = (SOAPHeaderBlock) headerIterator.next();

                                    System.out.println("soapHeaderBlock.getLocalName() = "
+ soapHeaderBlock.getLocalName());

 

                        }

                        System.out.println("Receiving Element.............................
\n");

                        System.out.println("Local Name = " + element.getLocalName().toString()
+ "\n");

                        Iterator iter = element.getChildElements();

 

                        int counter = 0;

                        while (iter.hasNext()) {

                                    System.out.println("Printing child number: " + counter
+ " \n");

 

                                    OMElement current = (OMElement) iter.next();

                                    // System.out.println(current.toString());

                                    String currentText = current.getText();

                                    System.out.println(current.getLocalName().toString());

                                    System.out.println(currentText);

                                    

                                    Iterator testing = current.getChildElements();

                                    while(testing.hasNext()) {

                                                OMElement foo = (OMElement) testing.next();

                                                // System.out.println(current.toString());

                                                String fooText = foo.getText();

                                                System.out.println(foo.getLocalName().toString());

                                                System.out.println(fooText);

                                                            

                                    }

 

                        }

 

                        // Create a navigator

…….

….

….

 

WSDL (I’m thinking it needs some work….): 

 

<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions name="DocumentServiceX"

            targetNamespace="http://schema.gaaoc.us/body/ga/washington/document/cse/2.0/document-schema.xsd"

            xmlns:tns="http://schema.gaaoc.us/body/ga/washington/document/cse/2.0/document-schema.xsd"

            xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 

            xmlns:xsd="http://www.w3.org/2001/XMLSchema">

            

            <wsdl:types>

                        <xsd:schema

                                    targetNamespace="http://schema.gaaoc.us/body/ga/washington/document/cse/2.0/document-schema.xsd"

                                    xmlns:tns="http://schema.gaaoc.us/body/ga/washington/document/cse/2.0/document-schema.xsd">

                                    <xsd:element name="childSupportEnforcementFilingRequest">

                                                <xsd:complexType>

                                                            <xsd:sequence>

                                                                        <xsd:element tns:name="element"
tns:type="xsd:anyType" />

                                                            </xsd:sequence>

                                                </xsd:complexType>

                                    </xsd:element>

                                    <xsd:element name="childSupportEnforcementFilingResponse">

                                                <xsd:complexType>

                                                            <xsd:sequence>

                                                                        <xsd:element name="return"
type="xsd:anyType" />

                                                            </xsd:sequence>

                                                </xsd:complexType>

                                    </xsd:element>

                        </xsd:schema>

            </wsdl:types>

            

            <wsdl:message name="childSupportEnforcementFilingResponseMessage">

                        <wsdl:part name="part1" element="tns:childSupportEnforcementFilingResponse"
/>

            </wsdl:message>

            <wsdl:message name="childSupportEnforcementFilingRequestMessage">

                        <wsdl:part name="part1" element="tns:childSupportEnforcementFilingRequest"
/>

            </wsdl:message>

            

            <wsdl:portType name="DocumentServiceXPort">

                        <wsdl:operation name="childSupportEnforcementFiling">

                                    <wsdl:input message="tns:childSupportEnforcementFilingRequestMessage"

                                                name="childSupportEnforcementFilingRequestMessage"
/>

                                    <wsdl:output message="tns:childSupportEnforcementFilingResponseMessage"

                                                name="childSupportEnforcementFilingResponseMessage"
/>

                        </wsdl:operation>

            </wsdl:portType>

            

            <wsdl:binding name="DocumentServiceXBinding" type="tns:DocumentServiceXPort">

                        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"
/>

                        <wsdl:operation name="childSupportEnforcementFiling">

                                    <soap:operation soapAction="childSupportEnforcementFiling"
style="document" />

                                    <wsdl:input>

                                                <soap:body use="literal" />

                                    </wsdl:input>

                                    <wsdl:output>

                                                <soap:body use="literal" />

                                    </wsdl:output>

                        </wsdl:operation>

            </wsdl:binding>

            <wsdl:service name="DocumentServiceX">

                        <wsdl:port binding="tns:DocumentServiceXBinding" name="DocumentServiceXPortType">

                                    <soap:address location="http://localhost:8080/axis2/services/DocumentServiceX"
/>

                        </wsdl:port>

            </wsdl:service>

</wsdl:definitions>

 

 

Example XML Instance: http://schema.gaaoc.us/body/ga/washington/document/cse/example-document.xml

 

XML Schema(s):  

http://schema.gaaoc.us/body/ga/washington/document/cse/document-schema.xsd

http://schema.gaaoc.us/body/ga/washington/document/cse/extension/extension-schema.xsd

http://schema.gaaoc.us/body/ga/washington/document/cse/jxdm/3.0.2/constraint-schema.xsd

 

Thanks!

 

Michael

 

 

________________________________



This e-mail and any files transmitted with it are intended solely
for the use of the entity or individual(s) to whom they are
addressed and not for reliance upon by unintended recipients. If
you are not the intended recipient or the person responsible for
delivering the e-mail to the intended recipient be advised that you
have received this e-mail in error and that any use, dissemination,
forwarding, printing, or copying of this e-mail and any files
transmitted are strictly prohibited. If you have received this
e-mail in error please delete the entire email and immediately
notify us by email to the sender or by telephone to the AOC main
office number, (404) 656-5171. Thank you.


Mime
View raw message