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 Brian Shields <bg...@yahoo.com> on 2004/02/03 16:11:27 UTC

sending xml files as string parameters

Hi all,
I am trying to send an xml file as a parameter in a web service call. This xml file is in string form. I have created the string using the XMLOutputter class from the jdom.output package. I send this to another locally hosted service, also deployed using axis, and everything works fine. I can create a jdom Document from the string. However when i send the request to a remotely hosted JWSDP deployed service i am getting an error. The error is:
deserialization error: unexpected XML reader state. expected: END but found: START: xmlFileParameter
where xmlFileParameter is the name of the Parameter added to the call.
 
I have caught the soap message arriving at the service, it is as following:
POST /LimaR/interface HTTP/1.0
Host: 127.0.0.1
Content-Type: text/xml; charset=utf-8
Content-Length: 2037
SOAPAction: ""
 
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:acceptXMLOrder xmlns:ns1="urn:Foo" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<xmlFileParameter xsi:type="xsd:string">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;PurchaseOrder xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;po.xsd&quot;&gt;
    &lt;poNumber&gt;jfd&lt;/poNumber&gt;
    &lt;shipTo&gt;
        &lt;name&gt;Alice Smith&lt;/name&gt;
        &lt;street&gt;123 Maple Street&lt;/street&gt;
        &lt;town-city&gt;Mill Valley&lt;/town-city&gt;
        &lt;state-county&gt;CA&lt;/state-county&gt;
        &lt;country&gt;USA&lt;/country&gt;
    &lt;/shipTo&gt;
    &lt;billTo&gt;
        &lt;name&gt;Robert Smith&lt;/name&gt;
        &lt;street&gt;8 Oak Avenue&lt;/street&gt;
        &lt;town-city&gt;Old Town&lt;/town-city&gt;
        &lt;state-county&gt;PA&lt;/state-county&gt;
        &lt;country&gt;USA&lt;/country&gt;
    &lt;/billTo&gt;
    &lt;comment&gt;Hurry, my lawn is going wild!&lt;/comment&gt;
    &lt;items&gt;
        &lt;item partNum=&quot;872-AA&quot;&gt;
            &lt;productName&gt;Lawnmower&lt;/productName&gt;
            &lt;quantity&gt;2&lt;/quantity&gt;
            &lt;USPrice&gt;12.12&lt;/USPrice&gt;
            &lt;comment&gt;Confirm this is electric&lt;/comment&gt;
        &lt;/item&gt;
        &lt;item partNum=&quot;926-AA&quot;&gt;
            &lt;productName&gt;Baby Monitor&lt;/productName&gt;
            &lt;quantity&gt;1&lt;/quantity&gt;
            &lt;USPrice&gt;390.98&lt;/USPrice&gt;
        &lt;/item&gt;
        &lt;totalPrice&gt;294.18&lt;/totalPrice&gt;
        &lt;shipDate&gt;2001-01-05&lt;/shipDate&gt;
    &lt;/items&gt;
&lt;/PurchaseOrder&gt;
</xmlFileParameter>
</ns1:acceptXMLOrder>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
 
This one is really confusing me!! anyone have any ideas?
Thanks,
Brian
 


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

Re: sending xml files as string parameters

Posted by Brian Shields <bg...@yahoo.com>.
Thanks Jeff,
Obviously ns1 is not a default namespace, but a default variable name for the urn:Foo namespace. this is what i meant. I set urn:Foo as the namespace by using the setTargetObjectURI method of the org.apache.soap.rpc.Call class. I just find it odd that it works perfectly when sent to an Axis deployed service and falls down when sent to a JWSDP deployed service!
Brian.


Jeff <je...@cogentlogic.com> wrote:Hi!
 
Clearly, the error message identifies the problem as the the opening tag of xmlFileParameter element. Since you are using UTF-8, the error is obviously not due to character encoding. The only other issue that comes to mind is the absence of a namespace: I'm speculating that JWSDP may not be able to handle this. This guess could be wrong but what else can you try?
 
By definition, a prefix, in this case ns1, does not reference a default namespace!
 
As to how you add the xmlns="urn:Foo" attribute to the xmlFileParameter element, I don't know. I gave up on Axis payload generation a while back because WSDL2Java has too many problems (I use a commercial product to generate the payload and Axis to wrap it in SOAP and handle message transmission/reception).
 
 
Jeff
 
 
----- Original Message ----- 
From: Brian Shields 
To: axis-user@ws.apache.org 
Sent: Tuesday, February 03, 2004 10:40 AM
Subject: Re: sending xml files as string parameters


How? that is an automatically generated SOAP message. I am simple creating a parameter...("xmlFileParameter, String.class, xmlFile, Constants.NS_URI_SOAP_ENC); where xmlFile is the string containing the xml file! II presume ns1 is a default namespace??
Brian

Jeff <je...@cogentlogic.com> wrote:
Try using:
 
<ns1:xmlFileParameter ...
 
 
Jeff
 
----- Original Message ----- 
From: Brian Shields 
To: axis-user@ws.apache.org 
Sent: Tuesday, February 03, 2004 10:11 AM
Subject: sending xml files as string parameters


Hi all,
I am trying to send an xml file as a parameter in a web service call. This xml file is in string form. I have created the string using the XMLOutputter class from the jdom.output package. I send this to another locally hosted service, also deployed using axis, and everything works fine. I can create a jdom Document from the string. However when i send the request to a remotely hosted JWSDP deployed service i am getting an error. The error is:
deserialization error: unexpected XML reader state. expected: END but found: START: xmlFileParameter
where xmlFileParameter is the name of the Parameter added to the call.

I have caught the soap message arriving at the service, it is as following:
POST /LimaR/interface HTTP/1.0
Host: 127.0.0.1
Content-Type: text/xml; charset=utf-8
Content-Length: 2037
SOAPAction: ""

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:acceptXMLOrder xmlns:ns1="urn:Foo" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<xmlFileParameter xsi:type="xsd:string">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;PurchaseOrder xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;po.xsd&quot;&gt;
    &lt;poNumber&gt;jfd&lt;/poNumber&gt;
    &lt;shipTo&gt;
        &lt;name&gt;Alice Smith&lt;/name&gt;
        &lt;street&gt;123 Maple Street&lt;/street&gt;
        &lt;town-city&gt;Mill Valley&lt;/town-city&gt;
        &lt;state-county&gt;CA&lt;/state-county&gt;
        &lt;country&gt;USA&lt;/country&gt;
    &lt;/shipTo&gt;
    &lt;billTo&gt;
        &lt;name&gt;Robert Smith&lt;/name&gt;
        &lt;street&gt;8 Oak Avenue&lt;/street&gt;
        &lt;town-city&gt;Old Town&lt;/town-city&gt;
        &lt;state-county&gt;PA&lt;/state-county&gt;
        &lt;country&gt;USA&lt;/country&gt;
    &lt;/billTo&gt;
    &lt;comment&gt;Hurry, my lawn is going wild!&lt;/comment&gt;
    &lt;items&gt;
        &lt;item partNum=&quot;872-AA&quot;&gt;
            &lt;productName&gt;Lawnmower&lt;/productName&gt;
            &lt;quantity&gt;2&lt;/quantity&gt;
            &lt;USPrice&gt;12.12&lt;/USPrice&gt;
            &lt;comment&gt;Confirm this is electric&lt;/comment&gt;
        &lt;/item&gt;
        &lt;item partNum=&quot;926-AA&quot;&gt;
            &lt;productName&gt;Baby Monitor&lt;/productName&gt;
            &lt;quantity&gt;1&lt;/quantity&gt;
            &lt;USPrice&gt;390.98&lt;/USPrice&gt;
        &lt;/item&gt;
        &lt;totalPrice&gt;294.18&lt;/totalPrice&gt;
        &lt;shipDate&gt;2001-01-05&lt;/shipDate&gt;
    &lt;/items&gt;
&lt;/PurchaseOrder&gt;
</xmlFileParameter>
</ns1:acceptXMLOrder>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This one is really confusing me!! anyone have any ideas?
Thanks,
Brian



---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

Re: sending xml files as string parameters

Posted by Brian Shields <bg...@yahoo.com>.
Tried setFullTargetObjectURI, there is still no namespace reference in the parameter! Will report back if we get this working!!

Jeff <je...@cogentlogic.com> wrote:Hi Brian,
 
This is just a shot in the dark but have you tried using setFullTargetObjectURI instead of setTargetObjectURI?
 
I don't find it odd that there's an Axis/JWSDP disconnect! There is too little effort put in to XML Schema-related tools. I'm not criticizing Apache here: active contributors do a great job with limited resources. Instead, consider that company with limitless resources that had a large hand in creating XML Schema: apparently, they have a technology called .NET. I produced an Axis/XchainJ-based web service recently that was an Open GIS Consortium 'Sensor Collection Service'. The WSDL file references an XML Schema comprised of 54 XML Schema documents (GML, XLink, ISO...). Some users wanted to use .NET. Apparently there's a .NET tool called WSDL.EXE that is supposed to generate client code from WSDL files _but_ it will not recurse through a hierarchy of XML Schema documents => useless for all but the most trivial of cases. Interestingly someone has tried to address this problem but their solution cannot handle more than one XML Schema document targeting the same namespace (in GML 3, for
 example, there are 27 XML Schema documents that target the one GML namespace!) => useless for all but the most trivial of cases, again!
 
This stuff is still bleeding-edge :-)
 
 
Jeff
 
 
----- Original Message ----- 
From: Brian Shields 
To: axis-user@ws.apache.org 
Sent: Tuesday, February 03, 2004 12:16 PM
Subject: Re: sending xml files as string parameters


Thanks Jeff,
Obviously ns1 is not a default namespace, but a default variable name for the urn:Foo namespace. this is what i meant. I set urn:Foo as the namespace by using the setTargetObjectURI method of the org.apache.soap.rpc.Call class. I just find it odd that it works perfectly when sent to an Axis deployed service and falls down when sent to a JWSDP deployed service!
Brian.


Jeff <je...@cogentlogic.com> wrote: Hi!
 
Clearly, the error message identifies the problem as the the opening tag of xmlFileParameter element. Since you are using UTF-8, the error is obviously not due to character encoding. The only other issue that comes to mind is the absence of a namespace: I'm speculating that JWSDP may not be able to handle this. This guess could be wrong but what else can you try?
 
By definition, a prefix, in this case ns1, does not reference a default namespace!
 
As to how you add the xmlns="urn:Foo" attribute to the xmlFileParameter element, I don't know. I gave up on Axis payload generation a while back because WSDL2Java has too many problems (I use a commercial product to generate the payload and Axis to wrap it in SOAP and handle message transmission/reception).
 
 
Jeff
 
 
----- Original Message ----- 
From: Brian Shields 
To: axis-user@ws.apache.org 
Sent: Tuesday, February 03, 2004 10:40 AM
Subject: Re: sending xml files as string parameters


How? that is an automatically generated SOAP message. I am simple creating a parameter...("xmlFileParameter, String.class, xmlFile, Constants.NS_URI_SOAP_ENC); where xmlFile is the string containing the xml file! II presume ns1 is a default namespace??
Brian

Jeff <je...@cogentlogic.com> wrote:
Try using:
 
<ns1:xmlFileParameter ...
 
 
Jeff
 
----- Original Message ----- 
From: Brian Shields 
To: axis-user@ws.apache.org 
Sent: Tuesday, February 03, 2004 10:11 AM
Subject: sending xml files as string parameters


Hi all,
I am trying to send an xml file as a parameter in a web service call. This xml file is in string form. I have created the string using the XMLOutputter class from the jdom.output package. I send this to another locally hosted service, also deployed using axis, and everything works fine. I can create a jdom Document from the string. However when i send the request to a remotely hosted JWSDP deployed service i am getting an error. The error is:
deserialization error: unexpected XML reader state. expected: END but found: START: xmlFileParameter
where xmlFileParameter is the name of the Parameter added to the call.

I have caught the soap message arriving at the service, it is as following:
POST /LimaR/interface HTTP/1.0
Host: 127.0.0.1
Content-Type: text/xml; charset=utf-8
Content-Length: 2037
SOAPAction: ""

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:acceptXMLOrder xmlns:ns1="urn:Foo" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<xmlFileParameter xsi:type="xsd:string">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;PurchaseOrder xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;po.xsd&quot;&gt;
    &lt;poNumber&gt;jfd&lt;/poNumber&gt;
    &lt;shipTo&gt;
        &lt;name&gt;Alice Smith&lt;/name&gt;
        &lt;street&gt;123 Maple Street&lt;/street&gt;
        &lt;town-city&gt;Mill Valley&lt;/town-city&gt;
        &lt;state-county&gt;CA&lt;/state-county&gt;
        &lt;country&gt;USA&lt;/country&gt;
    &lt;/shipTo&gt;
    &lt;billTo&gt;
        &lt;name&gt;Robert Smith&lt;/name&gt;
        &lt;street&gt;8 Oak Avenue&lt;/street&gt;
        &lt;town-city&gt;Old Town&lt;/town-city&gt;
        &lt;state-county&gt;PA&lt;/state-county&gt;
        &lt;country&gt;USA&lt;/country&gt;
    &lt;/billTo&gt;
    &lt;comment&gt;Hurry, my lawn is going wild!&lt;/comment&gt;
    &lt;items&gt;
        &lt;item partNum=&quot;872-AA&quot;&gt;
            &lt;productName&gt;Lawnmower&lt;/productName&gt;
            &lt;quantity&gt;2&lt;/quantity&gt;
            &lt;USPrice&gt;12.12&lt;/USPrice&gt;
            &lt;comment&gt;Confirm this is electric&lt;/comment&gt;
        &lt;/item&gt;
        &lt;item partNum=&quot;926-AA&quot;&gt;
            &lt;productName&gt;Baby Monitor&lt;/productName&gt;
            &lt;quantity&gt;1&lt;/quantity&gt;
            &lt;USPrice&gt;390.98&lt;/USPrice&gt;
        &lt;/item&gt;
        &lt;totalPrice&gt;294.18&lt;/totalPrice&gt;
        &lt;shipDate&gt;2001-01-05&lt;/shipDate&gt;
    &lt;/items&gt;
&lt;/PurchaseOrder&gt;
</xmlFileParameter>
</ns1:acceptXMLOrder>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This one is really confusing me!! anyone have any ideas?
Thanks,
Brian



---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

Re: sending xml files as string parameters

Posted by Jeff <je...@cogentlogic.com>.
Hi Brian,

This is just a shot in the dark but have you tried using setFullTargetObjectURI instead of setTargetObjectURI?

I don't find it odd that there's an Axis/JWSDP disconnect! There is too little effort put in to XML Schema-related tools. I'm not criticizing Apache here: active contributors do a great job with limited resources. Instead, consider that company with limitless resources that had a large hand in creating XML Schema: apparently, they have a technology called .NET. I produced an Axis/XchainJ-based web service recently that was an Open GIS Consortium 'Sensor Collection Service'. The WSDL file references an XML Schema comprised of 54 XML Schema documents (GML, XLink, ISO...). Some users wanted to use .NET. Apparently there's a .NET tool called WSDL.EXE that is supposed to generate client code from WSDL files _but_ it will not recurse through a hierarchy of XML Schema documents => useless for all but the most trivial of cases. Interestingly someone has tried to address this problem but their solution cannot handle more than one XML Schema document targeting the same namespace (in GML 3, for example, there are 27 XML Schema documents that target the one GML namespace!) => useless for all but the most trivial of cases, again!

This stuff is still bleeding-edge :-)


Jeff


  ----- Original Message ----- 
  From: Brian Shields 
  To: axis-user@ws.apache.org 
  Sent: Tuesday, February 03, 2004 12:16 PM
  Subject: Re: sending xml files as string parameters


  Thanks Jeff,
  Obviously ns1 is not a default namespace, but a default variable name for the urn:Foo namespace. this is what i meant. I set urn:Foo as the namespace by using the setTargetObjectURI method of the org.apache.soap.rpc.Call class. I just find it odd that it works perfectly when sent to an Axis deployed service and falls down when sent to a JWSDP deployed service!
  Brian.


  Jeff <je...@cogentlogic.com> wrote: 
    Hi!

    Clearly, the error message identifies the problem as the the opening tag of xmlFileParameter element. Since you are using UTF-8, the error is obviously not due to character encoding. The only other issue that comes to mind is the absence of a namespace: I'm speculating that JWSDP may not be able to handle this. This guess could be wrong but what else can you try?

    By definition, a prefix, in this case ns1, does not reference a default namespace!

    As to how you add the xmlns="urn:Foo" attribute to the xmlFileParameter element, I don't know. I gave up on Axis payload generation a while back because WSDL2Java has too many problems (I use a commercial product to generate the payload and Axis to wrap it in SOAP and handle message transmission/reception).


    Jeff


      ----- Original Message ----- 
      From: Brian Shields 
      To: axis-user@ws.apache.org 
      Sent: Tuesday, February 03, 2004 10:40 AM
      Subject: Re: sending xml files as string parameters


      How? that is an automatically generated SOAP message. I am simple creating a parameter...("xmlFileParameter, String.class, xmlFile, Constants.NS_URI_SOAP_ENC); where xmlFile is the string containing the xml file! II presume ns1 is a default namespace??
      Brian

      Jeff <je...@cogentlogic.com> wrote:
        Try using:

        <ns1:xmlFileParameter ...


        Jeff

          ----- Original Message ----- 
          From: Brian Shields 
          To: axis-user@ws.apache.org 
          Sent: Tuesday, February 03, 2004 10:11 AM
          Subject: sending xml files as string parameters


          Hi all,
          I am trying to send an xml file as a parameter in a web service call. This xml file is in string form. I have created the string using the XMLOutputter class from the jdom.output package. I send this to another locally hosted service, also deployed using axis, and everything works fine. I can create a jdom Document from the string. However when i send the request to a remotely hosted JWSDP deployed service i am getting an error. The error is:
          deserialization error: unexpected XML reader state. expected: END but found: START: xmlFileParameter
          where xmlFileParameter is the name of the Parameter added to the call.
          I have caught the soap message arriving at the service, it is as following:
          POST /LimaR/interface HTTP/1.0
          Host: 127.0.0.1
          Content-Type: text/xml; charset=utf-8
          Content-Length: 2037
          SOAPAction: ""
          <?xml version='1.0' encoding='UTF-8'?>
          <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
          <SOAP-ENV:Body>
          <ns1:acceptXMLOrder xmlns:ns1="urn:Foo" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
          <xmlFileParameter xsi:type="xsd:string">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
          &lt;PurchaseOrder xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;po.xsd&quot;&gt;
              &lt;poNumber&gt;jfd&lt;/poNumber&gt;
              &lt;shipTo&gt;
                  &lt;name&gt;Alice Smith&lt;/name&gt;
                  &lt;street&gt;123 Maple Street&lt;/street&gt;
                  &lt;town-city&gt;Mill Valley&lt;/town-city&gt;
                  &lt;state-county&gt;CA&lt;/state-county&gt;
                  &lt;country&gt;USA&lt;/country&gt;
              &lt;/shipTo&gt;
              &lt;billTo&gt;
                  &lt;name&gt;Robert Smith&lt;/name&gt;
                  &lt;street&gt;8 Oak Avenue&lt;/street&gt;
                  &lt;town-city&gt;Old Town&lt;/town-city&gt;
                  &lt;state-county&gt;PA&lt;/state-county&gt;
                  &lt;country&gt;USA&lt;/country&gt;
              &lt;/billTo&gt;
              &lt;comment&gt;Hurry, my lawn is going wild!&lt;/comment&gt;
              &lt;items&gt;
                  &lt;item partNum=&quot;872-AA&quot;&gt;
                      &lt;productName&gt;Lawnmower&lt;/productName&gt;
                      &lt;quantity&gt;2&lt;/quantity&gt;
                      &lt;USPrice&gt;12.12&lt;/USPrice&gt;
                      &lt;comment&gt;Confirm this is electric&lt;/comment&gt;
                  &lt;/item&gt;
                  &lt;item partNum=&quot;926-AA&quot;&gt;
                      &lt;productName&gt;Baby Monitor&lt;/productName&gt;
                      &lt;quantity&gt;1&lt;/quantity&gt;
                      &lt;USPrice&gt;390.98&lt;/USPrice&gt;
                  &lt;/item&gt;
                  &lt;totalPrice&gt;294.18&lt;/totalPrice&gt;
                  &lt;shipDate&gt;2001-01-05&lt;/shipDate&gt;
              &lt;/items&gt;
          &lt;/PurchaseOrder&gt;
          </xmlFileParameter>
          </ns1:acceptXMLOrder>
          </SOAP-ENV:Body>
          </SOAP-ENV:Envelope>
          This one is really confusing me!! anyone have any ideas?
          Thanks,
          Brian


----------------------------------------------------------------------
          Do you Yahoo!?
          Yahoo! SiteBuilder - Free web site building tool. Try it!


--------------------------------------------------------------------------
      Do you Yahoo!?
      Yahoo! SiteBuilder - Free web site building tool. Try it!


------------------------------------------------------------------------------
  Do you Yahoo!?
  Yahoo! SiteBuilder - Free web site building tool. Try it!

Re: sending xml files as string parameters

Posted by Brian Shields <bg...@yahoo.com>.
Thanks Jeff,
Obviously ns1 is not a default namespace, but a default variable name for the urn:Foo namespace. this is what i meant. I set urn:Foo as the namespace by using the setTargetObjectURI method of the org.apache.soap.rpc.Call class. I just find it odd that it works perfectly when sent to an Axis deployed service and falls down when sent to a JWSDP deployed service!
Brian.


Jeff <je...@cogentlogic.com> wrote:Hi!
 
Clearly, the error message identifies the problem as the the opening tag of xmlFileParameter element. Since you are using UTF-8, the error is obviously not due to character encoding. The only other issue that comes to mind is the absence of a namespace: I'm speculating that JWSDP may not be able to handle this. This guess could be wrong but what else can you try?
 
By definition, a prefix, in this case ns1, does not reference a default namespace!
 
As to how you add the xmlns="urn:Foo" attribute to the xmlFileParameter element, I don't know. I gave up on Axis payload generation a while back because WSDL2Java has too many problems (I use a commercial product to generate the payload and Axis to wrap it in SOAP and handle message transmission/reception).
 
 
Jeff
 
 
----- Original Message ----- 
From: Brian Shields 
To: axis-user@ws.apache.org 
Sent: Tuesday, February 03, 2004 10:40 AM
Subject: Re: sending xml files as string parameters


How? that is an automatically generated SOAP message. I am simple creating a parameter...("xmlFileParameter, String.class, xmlFile, Constants.NS_URI_SOAP_ENC); where xmlFile is the string containing the xml file! II presume ns1 is a default namespace??
Brian

Jeff <je...@cogentlogic.com> wrote:
Try using:
 
<ns1:xmlFileParameter ...
 
 
Jeff
 
----- Original Message ----- 
From: Brian Shields 
To: axis-user@ws.apache.org 
Sent: Tuesday, February 03, 2004 10:11 AM
Subject: sending xml files as string parameters


Hi all,
I am trying to send an xml file as a parameter in a web service call. This xml file is in string form. I have created the string using the XMLOutputter class from the jdom.output package. I send this to another locally hosted service, also deployed using axis, and everything works fine. I can create a jdom Document from the string. However when i send the request to a remotely hosted JWSDP deployed service i am getting an error. The error is:
deserialization error: unexpected XML reader state. expected: END but found: START: xmlFileParameter
where xmlFileParameter is the name of the Parameter added to the call.

I have caught the soap message arriving at the service, it is as following:
POST /LimaR/interface HTTP/1.0
Host: 127.0.0.1
Content-Type: text/xml; charset=utf-8
Content-Length: 2037
SOAPAction: ""

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:acceptXMLOrder xmlns:ns1="urn:Foo" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<xmlFileParameter xsi:type="xsd:string">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;PurchaseOrder xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;po.xsd&quot;&gt;
    &lt;poNumber&gt;jfd&lt;/poNumber&gt;
    &lt;shipTo&gt;
        &lt;name&gt;Alice Smith&lt;/name&gt;
        &lt;street&gt;123 Maple Street&lt;/street&gt;
        &lt;town-city&gt;Mill Valley&lt;/town-city&gt;
        &lt;state-county&gt;CA&lt;/state-county&gt;
        &lt;country&gt;USA&lt;/country&gt;
    &lt;/shipTo&gt;
    &lt;billTo&gt;
        &lt;name&gt;Robert Smith&lt;/name&gt;
        &lt;street&gt;8 Oak Avenue&lt;/street&gt;
        &lt;town-city&gt;Old Town&lt;/town-city&gt;
        &lt;state-county&gt;PA&lt;/state-county&gt;
        &lt;country&gt;USA&lt;/country&gt;
    &lt;/billTo&gt;
    &lt;comment&gt;Hurry, my lawn is going wild!&lt;/comment&gt;
    &lt;items&gt;
        &lt;item partNum=&quot;872-AA&quot;&gt;
            &lt;productName&gt;Lawnmower&lt;/productName&gt;
            &lt;quantity&gt;2&lt;/quantity&gt;
            &lt;USPrice&gt;12.12&lt;/USPrice&gt;
            &lt;comment&gt;Confirm this is electric&lt;/comment&gt;
        &lt;/item&gt;
        &lt;item partNum=&quot;926-AA&quot;&gt;
            &lt;productName&gt;Baby Monitor&lt;/productName&gt;
            &lt;quantity&gt;1&lt;/quantity&gt;
            &lt;USPrice&gt;390.98&lt;/USPrice&gt;
        &lt;/item&gt;
        &lt;totalPrice&gt;294.18&lt;/totalPrice&gt;
        &lt;shipDate&gt;2001-01-05&lt;/shipDate&gt;
    &lt;/items&gt;
&lt;/PurchaseOrder&gt;
</xmlFileParameter>
</ns1:acceptXMLOrder>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This one is really confusing me!! anyone have any ideas?
Thanks,
Brian



---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!


---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

Re: sending xml files as string parameters

Posted by Jeff <je...@cogentlogic.com>.
Hi!

Clearly, the error message identifies the problem as the the opening tag of xmlFileParameter element. Since you are using UTF-8, the error is obviously not due to character encoding. The only other issue that comes to mind is the absence of a namespace: I'm speculating that JWSDP may not be able to handle this. This guess could be wrong but what else can you try?

By definition, a prefix, in this case ns1, does not reference a default namespace!

As to how you add the xmlns="urn:Foo" attribute to the xmlFileParameter element, I don't know. I gave up on Axis payload generation a while back because WSDL2Java has too many problems (I use a commercial product to generate the payload and Axis to wrap it in SOAP and handle message transmission/reception).


Jeff


  ----- Original Message ----- 
  From: Brian Shields 
  To: axis-user@ws.apache.org 
  Sent: Tuesday, February 03, 2004 10:40 AM
  Subject: Re: sending xml files as string parameters


  How? that is an automatically generated SOAP message. I am simple creating a parameter...("xmlFileParameter, String.class, xmlFile, Constants.NS_URI_SOAP_ENC); where xmlFile is the string containing the xml file! II presume ns1 is a default namespace??
  Brian

  Jeff <je...@cogentlogic.com> wrote:
    Try using:

    <ns1:xmlFileParameter ...


    Jeff

      ----- Original Message ----- 
      From: Brian Shields 
      To: axis-user@ws.apache.org 
      Sent: Tuesday, February 03, 2004 10:11 AM
      Subject: sending xml files as string parameters


      Hi all,
      I am trying to send an xml file as a parameter in a web service call. This xml file is in string form. I have created the string using the XMLOutputter class from the jdom.output package. I send this to another locally hosted service, also deployed using axis, and everything works fine. I can create a jdom Document from the string. However when i send the request to a remotely hosted JWSDP deployed service i am getting an error. The error is:
      deserialization error: unexpected XML reader state. expected: END but found: START: xmlFileParameter
      where xmlFileParameter is the name of the Parameter added to the call.
      I have caught the soap message arriving at the service, it is as following:
      POST /LimaR/interface HTTP/1.0
      Host: 127.0.0.1
      Content-Type: text/xml; charset=utf-8
      Content-Length: 2037
      SOAPAction: ""
      <?xml version='1.0' encoding='UTF-8'?>
      <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <SOAP-ENV:Body>
      <ns1:acceptXMLOrder xmlns:ns1="urn:Foo" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      <xmlFileParameter xsi:type="xsd:string">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
      &lt;PurchaseOrder xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;po.xsd&quot;&gt;
          &lt;poNumber&gt;jfd&lt;/poNumber&gt;
          &lt;shipTo&gt;
              &lt;name&gt;Alice Smith&lt;/name&gt;
              &lt;street&gt;123 Maple Street&lt;/street&gt;
              &lt;town-city&gt;Mill Valley&lt;/town-city&gt;
              &lt;state-county&gt;CA&lt;/state-county&gt;
              &lt;country&gt;USA&lt;/country&gt;
          &lt;/shipTo&gt;
          &lt;billTo&gt;
              &lt;name&gt;Robert Smith&lt;/name&gt;
              &lt;street&gt;8 Oak Avenue&lt;/street&gt;
              &lt;town-city&gt;Old Town&lt;/town-city&gt;
              &lt;state-county&gt;PA&lt;/state-county&gt;
              &lt;country&gt;USA&lt;/country&gt;
          &lt;/billTo&gt;
          &lt;comment&gt;Hurry, my lawn is going wild!&lt;/comment&gt;
          &lt;items&gt;
              &lt;item partNum=&quot;872-AA&quot;&gt;
                  &lt;productName&gt;Lawnmower&lt;/productName&gt;
                  &lt;quantity&gt;2&lt;/quantity&gt;
                  &lt;USPrice&gt;12.12&lt;/USPrice&gt;
                  &lt;comment&gt;Confirm this is electric&lt;/comment&gt;
              &lt;/item&gt;
              &lt;item partNum=&quot;926-AA&quot;&gt;
                  &lt;productName&gt;Baby Monitor&lt;/productName&gt;
                  &lt;quantity&gt;1&lt;/quantity&gt;
                  &lt;USPrice&gt;390.98&lt;/USPrice&gt;
              &lt;/item&gt;
              &lt;totalPrice&gt;294.18&lt;/totalPrice&gt;
              &lt;shipDate&gt;2001-01-05&lt;/shipDate&gt;
          &lt;/items&gt;
      &lt;/PurchaseOrder&gt;
      </xmlFileParameter>
      </ns1:acceptXMLOrder>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
      This one is really confusing me!! anyone have any ideas?
      Thanks,
      Brian


--------------------------------------------------------------------------
      Do you Yahoo!?
      Yahoo! SiteBuilder - Free web site building tool. Try it!


------------------------------------------------------------------------------
  Do you Yahoo!?
  Yahoo! SiteBuilder - Free web site building tool. Try it!

Re: sending xml files as string parameters

Posted by Brian Shields <bg...@yahoo.com>.
How? that is an automatically generated SOAP message. I am simple creating a parameter...("xmlFileParameter, String.class, xmlFile, Constants.NS_URI_SOAP_ENC); where xmlFile is the string containing the xml file! II presume ns1 is a default namespace??
Brian

Jeff <je...@cogentlogic.com> wrote:
Try using:
 
<ns1:xmlFileParameter ...
 
 
Jeff
 
----- Original Message ----- 
From: Brian Shields 
To: axis-user@ws.apache.org 
Sent: Tuesday, February 03, 2004 10:11 AM
Subject: sending xml files as string parameters


Hi all,
I am trying to send an xml file as a parameter in a web service call. This xml file is in string form. I have created the string using the XMLOutputter class from the jdom.output package. I send this to another locally hosted service, also deployed using axis, and everything works fine. I can create a jdom Document from the string. However when i send the request to a remotely hosted JWSDP deployed service i am getting an error. The error is:
deserialization error: unexpected XML reader state. expected: END but found: START: xmlFileParameter
where xmlFileParameter is the name of the Parameter added to the call.

I have caught the soap message arriving at the service, it is as following:
POST /LimaR/interface HTTP/1.0
Host: 127.0.0.1
Content-Type: text/xml; charset=utf-8
Content-Length: 2037
SOAPAction: ""

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<ns1:acceptXMLOrder xmlns:ns1="urn:Foo" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<xmlFileParameter xsi:type="xsd:string">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;PurchaseOrder xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;po.xsd&quot;&gt;
    &lt;poNumber&gt;jfd&lt;/poNumber&gt;
    &lt;shipTo&gt;
        &lt;name&gt;Alice Smith&lt;/name&gt;
        &lt;street&gt;123 Maple Street&lt;/street&gt;
        &lt;town-city&gt;Mill Valley&lt;/town-city&gt;
        &lt;state-county&gt;CA&lt;/state-county&gt;
        &lt;country&gt;USA&lt;/country&gt;
    &lt;/shipTo&gt;
    &lt;billTo&gt;
        &lt;name&gt;Robert Smith&lt;/name&gt;
        &lt;street&gt;8 Oak Avenue&lt;/street&gt;
        &lt;town-city&gt;Old Town&lt;/town-city&gt;
        &lt;state-county&gt;PA&lt;/state-county&gt;
        &lt;country&gt;USA&lt;/country&gt;
    &lt;/billTo&gt;
    &lt;comment&gt;Hurry, my lawn is going wild!&lt;/comment&gt;
    &lt;items&gt;
        &lt;item partNum=&quot;872-AA&quot;&gt;
            &lt;productName&gt;Lawnmower&lt;/productName&gt;
            &lt;quantity&gt;2&lt;/quantity&gt;
            &lt;USPrice&gt;12.12&lt;/USPrice&gt;
            &lt;comment&gt;Confirm this is electric&lt;/comment&gt;
        &lt;/item&gt;
        &lt;item partNum=&quot;926-AA&quot;&gt;
            &lt;productName&gt;Baby Monitor&lt;/productName&gt;
            &lt;quantity&gt;1&lt;/quantity&gt;
            &lt;USPrice&gt;390.98&lt;/USPrice&gt;
        &lt;/item&gt;
        &lt;totalPrice&gt;294.18&lt;/totalPrice&gt;
        &lt;shipDate&gt;2001-01-05&lt;/shipDate&gt;
    &lt;/items&gt;
&lt;/PurchaseOrder&gt;
</xmlFileParameter>
</ns1:acceptXMLOrder>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This one is really confusing me!! anyone have any ideas?
Thanks,
Brian



---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!

Re: sending xml files as string parameters

Posted by Jeff <je...@cogentlogic.com>.
Try using:

<ns1:xmlFileParameter ...


Jeff

  ----- Original Message ----- 
  From: Brian Shields 
  To: axis-user@ws.apache.org 
  Sent: Tuesday, February 03, 2004 10:11 AM
  Subject: sending xml files as string parameters


  Hi all,
  I am trying to send an xml file as a parameter in a web service call. This xml file is in string form. I have created the string using the XMLOutputter class from the jdom.output package. I send this to another locally hosted service, also deployed using axis, and everything works fine. I can create a jdom Document from the string. However when i send the request to a remotely hosted JWSDP deployed service i am getting an error. The error is:
  deserialization error: unexpected XML reader state. expected: END but found: START: xmlFileParameter
  where xmlFileParameter is the name of the Parameter added to the call.

  I have caught the soap message arriving at the service, it is as following:
  POST /LimaR/interface HTTP/1.0
  Host: 127.0.0.1
  Content-Type: text/xml; charset=utf-8
  Content-Length: 2037
  SOAPAction: ""

  <?xml version='1.0' encoding='UTF-8'?>
  <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <SOAP-ENV:Body>
  <ns1:acceptXMLOrder xmlns:ns1="urn:Foo" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <xmlFileParameter xsi:type="xsd:string">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
  &lt;PurchaseOrder xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;po.xsd&quot;&gt;
      &lt;poNumber&gt;jfd&lt;/poNumber&gt;
      &lt;shipTo&gt;
          &lt;name&gt;Alice Smith&lt;/name&gt;
          &lt;street&gt;123 Maple Street&lt;/street&gt;
          &lt;town-city&gt;Mill Valley&lt;/town-city&gt;
          &lt;state-county&gt;CA&lt;/state-county&gt;
          &lt;country&gt;USA&lt;/country&gt;
      &lt;/shipTo&gt;
      &lt;billTo&gt;
          &lt;name&gt;Robert Smith&lt;/name&gt;
          &lt;street&gt;8 Oak Avenue&lt;/street&gt;
          &lt;town-city&gt;Old Town&lt;/town-city&gt;
          &lt;state-county&gt;PA&lt;/state-county&gt;
          &lt;country&gt;USA&lt;/country&gt;
      &lt;/billTo&gt;
      &lt;comment&gt;Hurry, my lawn is going wild!&lt;/comment&gt;
      &lt;items&gt;
          &lt;item partNum=&quot;872-AA&quot;&gt;
              &lt;productName&gt;Lawnmower&lt;/productName&gt;
              &lt;quantity&gt;2&lt;/quantity&gt;
              &lt;USPrice&gt;12.12&lt;/USPrice&gt;
              &lt;comment&gt;Confirm this is electric&lt;/comment&gt;
          &lt;/item&gt;
          &lt;item partNum=&quot;926-AA&quot;&gt;
              &lt;productName&gt;Baby Monitor&lt;/productName&gt;
              &lt;quantity&gt;1&lt;/quantity&gt;
              &lt;USPrice&gt;390.98&lt;/USPrice&gt;
          &lt;/item&gt;
          &lt;totalPrice&gt;294.18&lt;/totalPrice&gt;
          &lt;shipDate&gt;2001-01-05&lt;/shipDate&gt;
      &lt;/items&gt;
  &lt;/PurchaseOrder&gt;
  </xmlFileParameter>
  </ns1:acceptXMLOrder>
  </SOAP-ENV:Body>
  </SOAP-ENV:Envelope>

  This one is really confusing me!! anyone have any ideas?
  Thanks,
  Brian



------------------------------------------------------------------------------
  Do you Yahoo!?
  Yahoo! SiteBuilder - Free web site building tool. Try it!