The service is expecting the string without the
<SCIncidentProcessing:query> element ... in other words, what you see as
"Input 2"
The stub that axis generated has the method with parameter of type
OMElement ( SCIncidentProcessing sCIncidentProcessing0), which is why I
had to create the OMElement input to pass into the method. It doesnt
allow me to just passing in a plain old String. But when I create the
OMElement, I had to do the following:
> OMFactory fac = OMAbstractFactory.getOMFactory();
> OMNamespace omNs = fac.createOMNamespace("http://namespace.com",
> "namespace");
> OMElement input = fac.createOMElement("query",omNs);
> input.addChild(fac.createOMText(xmldata));
This adds the <SCIncidentProcessing:query> element to it. I couldnt find a
way to create the OMElement object with just the xmldata string. Is there
a way to create an OMElement without adding the
<SCIncidentProcessing:query> element to it?
"Anne Thomas Manes" <[EMAIL PROTECTED]>
05/21/2008 11:16 AM
Please respond to
[email protected]
To
[email protected]
cc
Subject
Re: Web service not compatible with Axis?
Sorry to be obtuse ...
Does the service expect the message payload to be wrapped in the
<SCIncidentProcessing:query> element? Or is it simply expecting the
message payload? Why are you using a combination of the stub with the
OMElement?
Your code is telling AXIOM to create the <SCIncidentProcessing:query>
element and to embed the string inside it.
Anne
On Wed, May 21, 2008 at 8:58 AM, <[EMAIL PROTECTED]> wrote:
>
> Thanks for your reply. The service provider does provide a description
of
> the expected string format. It expects a string of XML much like the
one I
> have shown below.
> The header Axis appends to the object sent to the web service seems to
be
> the cause of the exception. Below is my code invoking the method using
Axis
> and displaying the inputs using toString() and getText()
>
> SCIncidentWebServiceStub stub = new SCIncidentWebServiceStub();
> OMFactory fac = OMAbstractFactory.getOMFactory();
> OMNamespace omNs = fac.createOMNamespace("http://namespace.com",
> "namespace");
> OMElement input = fac.createOMElement("query",omNs);
> input.addChild(fac.createOMText(xmldata));
> System.out.println("Input1");
> System.out.println(input.toString());
> System.out.println("Input2");
> System.out.println(input.getText());
> OMElement output = stub.SCIncidentProcessing(input);
>
> This is what is shown in the console:
> Input1
> <SCIncidentProcessing:query
> xmlns:SCIncidentProcessing="http://namespace.com"><?xml version='1.0'
> encoding='utf-8' standalone='yes'?><SCIncidentWebService
>
action='query'><setup><webserviceUser>User1</webserviceUser><webserviceUserPassword>testPassword01</webserviceUserPassword><eventUser>ABC123lt;/eventUser></setup><incident><incidentNumber>10697040</incidentNumber><workHistory><workHistoryType>All</workHistoryType></workHistory></incident></SCIncidentWebService></SCIncidentProcessing:query>
>
> Input2
> <?xml version='1.0' encoding='utf-8'
standalone='yes'?><SCIncidentWebService
>
action='query'><setup><webserviceUser>User1</webserviceUser><webserviceUserPassword>testPassword01</webserviceUserPassword><eventUser>ABC123</eventUser></setup><incident><incidentNumber>10697040</incidentNumber><workHistory><workHistoryType>All</workHistoryType></workHistory></incident></SCIncidentWebService>
>
>
> I have used Eclipse generated web service client stubs to invoke this
web
> service successfully. This is because the Eclipse generated stubs
provide
> the method SCIncidentProcessing(String inputString) rather than
> theSCIncidentProcessing(OMElement sCIncidentProcessing0) method that
Axis
> generated stubs provide.
>
> When I invoke the web service using the Eclipse generated client stubs
> instead of Axis (with the input string like "Input 2" above, I get no
> exceptions and I get correct results back from the web service But with
> Axis, I get the exception that I mentioned before. So it seems like to
me
> that the webservice is doing a toString() instead of a getText() on the
> input before doing any processing. Could this mean that the particular
web
> service I am trying to use is not compatible with Axis?
>
>
>
> "Anne Thomas Manes" <[EMAIL PROTECTED]>
>
> 05/20/2008 07:46 PM
>
> Please respond to
> [email protected]
> To
> [email protected]
> cc
> Subject
> Re: Web service not compatible with Axis?
>
>
>
>
> Why does the service exchange strings rather than typed XML? If it's a
> web service, it should define its interface using a
> language-independent API, such as WSDL or a schema. Did the service
> provider at least provide you with a description of the expected
> string format? The first place I'd look is at the input message. My
> guess is that it isn't formatted properly.
>
> Anne
>
> On Tue, May 20, 2008 at 9:41 AM, <[EMAIL PROTECTED]> wrote:
>>
>> There is a web service that I am accessing that provides a method,
>> SCIncidentProcessing(String inputString) which will also return a
string
>> of
>> XML data.
>> Axis2/Java generates the stubs with the method
>> SCIncidentProcessing(OMElement sCIncidentProcessing0). I am getting an
>> exception back from the web service when I invoke it from a client
class.
>>
>> The following is what I get when I display the output:
>>
>> <?xml version="1.0" encoding="utf-8"
>> standalone="yes"?><SCIncidentWebService
>>
>>
action="unknown"><response><returnCode>1</returnCode><error><number>914</number><description>An
>> exception has occurred during the ErrorProcessing functionality of the
>> SCIncidentWebService. Please check the output logs and notify the
system
>> administrator.</description><exception>System.NullReferenceException:
>> Object
>> reference not set to an instance of an object.
>> at
SCIncidentWebService.SCIncidentWebService.SCIncidentProcessing(String
>> inputString)</exception></error></response></SCIncidentWebService>
>>
>> Does this mean the web service is not handling the object passed in
>> correctly?
>>
>> I am invoking the webservice in a client class with the following
section
>> of
>> code:
>> String xmldata = "sample data";
>> SCIncidentWebServiceStub stub = new SCIncidentWebServiceStub();
>> OMFactory fac = OMAbstractFactory.getOMFactory();
>> OMNamespace omNs = fac.createOMNamespace("http://namespace.com",
>> "namespace");
>> OMElement input = fac.createOMElement("query",omNs);
>> input.addChild(fac.createOMText(xmldata));
>> OMElement output = stub.SCIncidentProcessing(input);
>> String results = output.getFirstElement().getText();
>> System.out.println(results);
>>
>> What do you guys think?
>>
>> ________________________________
>>
>> This communication is for informational purposes only. It is not
intended
>> as
>> an offer or solicitation for the purchase or sale of any financial
>> instrument or as an official confirmation of any transaction. All
market
>> prices, data and other information are not warranted as to completeness
or
>> accuracy and are subject to change without notice. Any comments or
>> statements made herein do not necessarily reflect those of JPMorgan
Chase
>> &
>> Co., its subsidiaries and affiliates. This transmission may contain
>> information that is privileged, confidential, legally privileged,
and/or
>> exempt from disclosure under applicable law. If you are not the
intended
>> recipient, you are hereby notified that any disclosure, copying,
>> distribution, or use of the information contained herein (including any
>> reliance thereon) is STRICTLY PROHIBITED. Although this transmission
and
>> any
>> attachments are believed to be free of any virus or other defect that
>> might
>> affect any computer system into which it is received and opened, it is
the
>> responsibility of the recipient to ensure that it is virus free and no
>> responsibility is accepted by JPMorgan Chase & Co., its subsidiaries
and
>> affiliates, as applicable, for any loss or damage arising in any way
from
>> its use. If you received this transmission in error, please immediately
>> contact the sender and destroy the material in its entirety, whether in
>> electronic or hard copy format. Thank you. Please refer to
>> http://www.jpmorgan.com/pages/disclosures for disclosures relating to
UK
>> legal entities.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]