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 Daniel Beland <dc...@gmail.com> on 2006/07/25 18:38:26 UTC

Axis 1.4 with soapenc:base64

Hi,


I have a problem with axis 1.4, and I am not sure if it is a bug.
I need to connect to an application that expose a generic web service.
The application is StreamServe, and the web service is meant to be able to
execute any service since we provide the service name and version in the
request.

So being generic, the data is defined as soapenc:base64, but the web service
itself is document literal. (WSDL will follow at the end).
I find this combination really odd and I am not sure if it is valid?


Here are the details:

The server expects the following kind of input:

         <SendDocument xmlns="
http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd">
            <ServiceDescription>whprod_service</ServiceDescription>
            <ServiceVersion>1</ServiceVersion>
            <ServerID></ServerID>

<DocData>PHRhYmxlPjxzY2hlbWUuc3RvY2ttPjx3YXJlaG91c2U+Q0w8L3dhcmVob3VzZT48cHJvZHVjdD5SVEstMDQjNzExMTAxLUwgICAgIDwvcHJvZHVjdD48L3NjaGVtZS5zdG9ja20+PC90YWJsZT4=</DocData>
         </SendDocument>


But Axis generates this instead (I removed some DocData elements to shorten
it):


         <SendDocument xmlns="
http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd">
            <ServiceDescription>whprod_service</ServiceDescription>
            <ServiceVersion>1</ServiceVersion>
            <ServerID></ServerID>
            <DocData xsi:type="xsd:byte">60</DocData>
            <DocData xsi:type="xsd:byte">116</DocData>
            <DocData xsi:type="xsd:byte">97</DocData>
            <DocData xsi:type="xsd:byte">98</DocData>
         </SendDocument>


All I do is this:

            String test =
"<table><scheme.stockm><warehouse>CL</warehouse><product>RTK-04#711101-L
</product></scheme.stockm></table>";
            byte[] array = test.getBytes();
            String value = binding.sendDocument("whprod_service", "1", "",
array);


I was able to make it works by changing the type of DocData to xs:anyType in
the WSDL and encoding the string myself like this:

            String test =
"<table><scheme.stockm><warehouse>CL</warehouse><product>RTK-04#711101-L
</product></scheme.stockm></table>";
            byte[] array = test.getBytes();
            String encoded = Base64.encode(array);
            String value = binding.sendDocument("whprod_service", "1", "",
encoded);

It gives me this:

         <SendDocument xmlns="
http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd">
            <ServiceDescription>whprod_service</ServiceDescription>
            <ServiceVersion>1</ServiceVersion>
            <ServerID></ServerID>
            <DocData
xsi:type="xsd:string">PHRhYmxlPjxzY2hlbWUuc3RvY2ttPjx3YXJlaG91c2U+Q0w8L3dhcmVob3VzZT48cHJvZHVjdD5SVEstMDQjNzExMTAxLUwgICAgIDwvcHJvZHVjdD48L3NjaGVtZS5zdG9ja20+PC90YWJsZT4=</DocData>
         </SendDocument>


I would like to know if it is a bug in axis, in which case I will open a bug
in jira or the problem comes from an invalid WSDL (document/literal with
soapenc types).

Thanks,
Daniel


Here is the wsdl:


<?xml version="1.0" encoding="utf-8" ?>
<definitions
    elementFormDefault="qualified"
    targetNamespace="
http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.wsdl"
    xmlns:tns="
http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.wsdl"
    xmlns:sbs="
http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd"
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns="http://schemas.xmlsoap.org/wsdl/" >

    <types>
        <xs:schema elementFormDefault="qualified" targetNamespace="
http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd" >
           <xs:import namespace="http://www.w3.org/2001/XMLSchema" />
           <xs:element name="SendDocument">
               <xs:complexType>
                  <xs:sequence>
                        <xs:element minOccurs="1" maxOccurs="1"
name="ServiceDescription" type="xs:string" />
                        <xs:element minOccurs="1" maxOccurs="1"
name="ServiceVersion" type="xs:string" />
                        <xs:element minOccurs="1" maxOccurs="1"
name="ServerID" type="xs:string" />
                        <xs:element minOccurs="1" maxOccurs="1"
name="DocData" type="soap-enc:base64" />
                  </xs:sequence>
              </xs:complexType>
           </xs:element>
               <xs:element name="SendReceiveDocument">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element minOccurs="1" maxOccurs="1"
name="ServiceDescription" type="xs:string" />
                        <xs:element minOccurs="1" maxOccurs="1"
name="ServiceVersion" type="xs:string" />
                        <xs:element minOccurs="1" maxOccurs="1"
name="ServerID" type="xs:string" />
                        <xs:element minOccurs="1" maxOccurs="1"
name="DocData" type="soap-enc:base64" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="SendDocumentResponse">
              <xs:complexType>
                  <xs:sequence>
                      <xs:element minOccurs="1" maxOccurs="1"
name="SendDocumentResult" type="xs:string" />
                  </xs:sequence>
              </xs:complexType>
           </xs:element>
           <xs:element name="SendReceiveDocumentResponse">
              <xs:complexType>
                  <xs:sequence>
                      <xs:element minOccurs="1" maxOccurs="1"
name="SendReceiveDocumentResult" type="xs:string" />
                      <xs:element minOccurs="1" maxOccurs="1" name="DocData"
type="soap-enc:base64" />
                  </xs:sequence>
              </xs:complexType>
           </xs:element>
           <xs:element name="SendDocumentFault">
              <xs:complexType>
                  <xs:sequence>
                      <xs:element minOccurs="0" maxOccurs="1"
name="ErrorCode" type="xs:string" />
                      <xs:element minOccurs="0" maxOccurs="1"
name="ErrorDescription" type="xs:string" />
                  </xs:sequence>
              </xs:complexType>
           </xs:element>
       </xs:schema>
    </types>

    <message name="SendDocumentIn">
        <part name="parameters" element="sbs:SendDocument"/>
    </message>

    <message name="SendReceiveDocumentIn">
        <part name="parameters" element="sbs:SendReceiveDocument"/>
    </message>
    <message name="SendDocumentOut">
        <part name="parameters" element="sbs:SendDocumentResponse"/>
    </message>
    <message name="SendReceiveDocumentOut">
        <part name="parameters" element="sbs:SendReceiveDocumentResponse"/>
    </message>
    <message name="SendDocumentFault">
        <part name="parameters" element="sbs:SendDocumentFault"/>
    </message>

    <portType name="SendDocumentPortType">
        <operation name="SendDocument">
            <documentation>
            Sends a document to ServiceBroker for processing.
            ServiceDescription:    The name of the service to execute.
            ServiceVersion:    The service version to use. This parameter
can be empty, indicating that the latest registered service should be used.
            DocData: A byte array with data sent to the service specified in
ServiceDescription.
            Return:    Parameter reserved for future use.
            </documentation>
            <input message="tns:SendDocumentIn"/>
            <output message="tns:SendDocumentOut"/>
            <fault name="SendDocumentFault"
message="tns:SendDocumentFault"/>
        </operation>
    </portType>

    <portType name="SendReceiveDocumentPortType">
        <operation name="SendReceiveDocument">
            <documentation>
            Sends a document to ServiceBroker for processing. The result
will be returned to the caller.
            ServiceDescription:    The name of the service to execute.
            ServiceVersion:    The service version to use. This parameter
can be empty, indicating that the latest registered service should be used.
            DocData: [in] A byte array with data sent to the service
specified in ServiceDescription. [out] A byte array with the result.
            Return:    Parameter reserved for future use.
            </documentation>
            <input message="tns:SendReceiveDocumentIn"/>
            <output message="tns:SendReceiveDocumentOut"/>
            <fault name="SendDocumentFault"
message="tns:SendDocumentFault"/>
        </operation>
    </portType>

    <binding name="SendDocumentSOAP" type="tns:SendDocumentPortType">
        <soap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
        <operation name="SendDocument">
           <soap:operation soapAction="
http://www.streamserve.com/xml/soap/servicebroker/4.1/senddocument"
style="document" />
           <input>
               <soap:body use="literal"/>
           </input>
           <output>
               <soap:body use="literal"/>
           </output>
            <fault name="SendDocumentFault">
                <soap:fault name="SendDocumentFault" use="literal"/>
            </fault>
        </operation>
    </binding>

    <binding name="SendReceiveDocumentSOAP"
type="tns:SendReceiveDocumentPortType">
        <soap:binding style="document" transport="
http://schemas.xmlsoap.org/soap/http"/>
        <operation name="SendReceiveDocument">
           <soap:operation soapAction="
http://www.streamserve.com/xml/soap/servicebroker/4.1/sendreceivedocument"
style="document" />
           <input>
               <soap:body use="literal"/>
           </input>
           <output>
               <soap:body use="literal"/>
           </output>
            <fault name="SendDocumentFault">
                <soap:fault name="SendDocumentFault" use="literal"/>
            </fault>
        </operation>
    </binding>

    <service name="StreamServe ServiceBroker">
        <documentation>StreamServe ServiceBroker SOAP
services.</documentation>
        <port name="SendDocumentPort" binding="tns:SendDocumentSOAP">
           <soap:address location="http://localhost:1717"/>
        </port>
        <port name="SendReceiveDocumentPort"
binding="tns:SendReceiveDocumentSOAP">
           <soap:address location="http://localhost:1717"/>
        </port>

    </service>

</definitions>

Re: Axis 1.4 with soapenc:base64

Posted by Anne Thomas Manes <at...@gmail.com>.
I suggest you tell the provider to fix the WSDL.

On 7/25/06, Daniel Beland <dc...@gmail.com> wrote:
>
> Hi Anne,
>
> Thanks for the reply but maybe my message was misleading.
>
> The WSDL comes from some other application and is not generated by Axis.
> I use axis to generate the java classes to connect to that service.
>
>
> Now I am wondering if the WSDL is invalid and I should ask the provider to
> correct it, or if it is Axis that is not handling the situation properly
> when it creates the SOAP message?
>
>
> I changed the type to xsd:base64Binary and it works perfectly, thanks. In
> the meantime this is what I'll do.
> The service is expecting binary data so giving it XML would not work (ie: It
> could be an excel document or some other file format).
>
> Thanks,
> Daniel
>
>
>
> On 7/25/06, Anne Thomas Manes <at...@gmail.com> wrote:
> >
>  Absolutely -- Axis should not be defining the data as soapenc:base64.
> I suggest that you modify the WSDL, replace the type with
> "xsd:base64binary" and regen the service.
>
> Alternatively, you might try sending the XML as XML rather than
> encoding it as binary.
>
> Anne
>
> On 7/25/06, Daniel Beland <dc...@gmail.com> wrote:
> >
> >
> > Hi,
> >
> >
> > I have a problem with axis 1.4, and I am not sure if it is a bug.
> > I need to connect to an application that expose a generic web service.
> > The application is StreamServe, and the web service is meant to be able to
> > execute any service since we provide the service name and version in the
> > request.
> >
> > So being generic, the data is defined as soapenc:base64, but the web
> service
> > itself is document literal. (WSDL will follow at the end).
> > I find this combination really odd and I am not sure if it is valid?
> >
> >
> > Here are the details:
> >
> > The server expects the following kind of input:
> >
> >          <SendDocument
> > xmlns="
> http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd
> > ">
> >
> > <ServiceDescription>whprod_service</ServiceDescription>
> >             <ServiceVersion>1</ServiceVersion>
> >             <ServerID></ServerID>
> >
> >
> <DocData>PHRhYmxlPjxzY2hlbWUuc3RvY2ttPjx3YXJlaG91c2U+Q0w8L3dhcmVob3VzZT48cHJvZHVjdD5SVEstMDQjNzExMTAxLUwgICAgIDwvcHJvZHVjdD48L3NjaGVtZS5zdG9ja20+PC90YWJsZT4=</DocData>
> >          </SendDocument>
> >
> >
> > But Axis generates this instead (I removed some DocData elements to
> shorten
> > it):
> >
> >
> >          <SendDocument xmlns="
> >
> http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd">
> >
> > <ServiceDescription>whprod_service</ServiceDescription>
> >             <ServiceVersion>1</ServiceVersion>
> >             <ServerID></ServerID>
> >             <DocData xsi:type="xsd:byte">60</DocData>
> >             <DocData xsi:type="xsd:byte">116</DocData>
> >             <DocData xsi:type="xsd:byte">97</DocData>
> >             <DocData xsi:type="xsd:byte">98</DocData>
> >          </SendDocument>
> >
> >
> > All I do is this:
> >
> >             String test =
> >
> "<table><scheme.stockm><warehouse>CL</warehouse><product>RTK-04#711101-L
> >     </product></scheme.stockm></table>";
> >             byte[] array = test.getBytes();
> >             String value = binding.sendDocument("whprod_service", "1", "",
> > array);
> >
> >
> > I was able to make it works by changing the type of DocData to xs:anyType
> in
> > the WSDL and encoding the string myself like this:
> >
> >             String test =
> >
> "<table><scheme.stockm><warehouse>CL</warehouse><product>RTK-04#711101-L
>  >     </product></scheme.stockm></table>";
> >             byte[] array = test.getBytes();
> >             String encoded = Base64.encode(array);
> >             String value = binding.sendDocument ("whprod_service", "1",
> "",
> > encoded);
> >
> > It gives me this:
> >
> >           <SendDocument
> > xmlns="
> http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd">
> >
> > <ServiceDescription>whprod_service</ServiceDescription>
> >             <ServiceVersion>1</ServiceVersion>
> >             <ServerID></ServerID>
> >             <DocData
> >
> xsi:type="xsd:string">PHRhYmxlPjxzY2hlbWUuc3RvY2ttPjx3YXJlaG91c2U+Q0w8L3dhcmVob3VzZT48cHJvZHVjdD5SVEstMDQjNzExMTAxLUwgICAgIDwvcHJvZHVjdD48L3NjaGVtZS5zdG9ja20+PC90YWJsZT4=</DocData>
> >          </SendDocument>
> >
> >
> > I would like to know if it is a bug in axis, in which case I will open a
> bug
> > in jira or the problem comes from an invalid WSDL (document/literal with
> > soapenc types).
> >
> > Thanks,
> > Daniel
> >
> >
> > Here is the wsdl:
> >
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <definitions
>  >     elementFormDefault="qualified"
> >     targetNamespace="
> >
> http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.wsdl
> "
> >
> >
> xmlns:tns="http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.wsdl
> > "
> >
> >
> xmlns:sbs="http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd"
> >     xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soap/"
> >
> >
> xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
> >     xmlns:xs=" http://www.w3.org/2001/XMLSchema"
> >     xmlns="http://schemas.xmlsoap.org/wsdl/" >
> >
> >     <types>
> >         <xs:schema elementFormDefault="qualified" targetNamespace="
> >
> http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd"
> > >
> >            <xs:import namespace="
> > http://www.w3.org/2001/XMLSchema" />
> >            <xs:element name="SendDocument">
> >                <xs:complexType>
> >                   <xs:sequence>
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="ServiceDescription" type="xs:string" />
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="ServiceVersion" type="xs:string" />
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="ServerID" type="xs:string" />
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="DocData" type="soap-enc:base64" />
> >                   </xs:sequence>
> >               </xs:complexType>
> >            </xs:element>
> >                <xs:element name="SendReceiveDocument">
> >                 <xs:complexType>
> >                     <xs:sequence>
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="ServiceDescription" type="xs:string" />
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="ServiceVersion" type="xs:string" />
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="ServerID" type="xs:string" />
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="DocData" type="soap-enc:base64" />
> >                     </xs:sequence>
> >                 </xs:complexType>
> >             </xs:element>
> >             <xs:element name="SendDocumentResponse">
> >               <xs:complexType>
> >                   <xs:sequence>
> >                       <xs:element minOccurs="1" maxOccurs="1"
> > name="SendDocumentResult" type="xs:string" />
> >                   </xs:sequence>
> >               </xs:complexType>
> >            </xs:element>
> >            <xs:element
> name="SendReceiveDocumentResponse">
> >               <xs:complexType>
> >                   <xs:sequence>
> >                       <xs:element minOccurs="1" maxOccurs="1"
> > name="SendReceiveDocumentResult" type="xs:string" />
> >                       <xs:element minOccurs="1" maxOccurs="1"
> name="DocData"
> > type="soap-enc:base64" />
> >                   </xs:sequence>
> >               </xs:complexType>
> >            </xs:element>
> >            <xs:element name="SendDocumentFault">
> >               <xs:complexType>
> >                   <xs:sequence>
> >                       <xs:element minOccurs="0" maxOccurs="1"
> > name="ErrorCode" type="xs:string" />
> >                       <xs:element minOccurs="0" maxOccurs="1"
> > name="ErrorDescription" type="xs:string" />
> >                   </xs:sequence>
> >               </xs:complexType>
> >            </xs:element>
> >        </xs:schema>
> >     </types>
> >
> >     <message name="SendDocumentIn">
> >         <part name="parameters" element="sbs:SendDocument"/>
> >     </message>
> >
> >     <message name="SendReceiveDocumentIn">
> >         <part name="parameters"
> > element="sbs:SendReceiveDocument"/>
> >     </message>
> >     <message name="SendDocumentOut">
> >         <part name="parameters"
> > element="sbs:SendDocumentResponse"/>
> >     </message>
> >     <message name="SendReceiveDocumentOut">
> >         <part name="parameters"
> > element="sbs:SendReceiveDocumentResponse"/>
> >     </message>
> >     <message name="SendDocumentFault">
> >         <part name="parameters"
> > element="sbs:SendDocumentFault"/>
> >     </message>
> >
> >     <portType name="SendDocumentPortType">
> >         <operation name="SendDocument">
> >             <documentation>
> >             Sends a document to ServiceBroker for processing.
> >             ServiceDescription:    The name of the service to execute.
> >             ServiceVersion:    The service version to use. This parameter
> > can be empty, indicating that the latest registered service should be
> used.
> >             DocData: A byte array with data sent to the service specified
> in
> > ServiceDescription.
> >             Return:    Parameter reserved for future use.
> >             </documentation>
> >             <input message="tns:SendDocumentIn"/>
> >             <output message="tns:SendDocumentOut"/>
> >             <fault name="SendDocumentFault"
> > message="tns:SendDocumentFault"/>
> >         </operation>
> >     </portType>
> >
> >     <portType name="SendReceiveDocumentPortType">
> >         <operation name="SendReceiveDocument">
> >             <documentation>
> >             Sends a document to ServiceBroker for processing. The result
> > will be returned to the caller.
> >             ServiceDescription:    The name of the service to execute.
> >             ServiceVersion:    The service version to use. This parameter
> > can be empty, indicating that the latest registered service should be
> used.
> >             DocData: [in] A byte array with data sent to the service
> > specified in ServiceDescription. [out] A byte array with the result.
> >             Return:    Parameter reserved for future use.
>  >             </documentation>
> >             <input message="tns:SendReceiveDocumentIn"/>
> >             <output
> message="tns:SendReceiveDocumentOut"/>
> >             <fault name="SendDocumentFault"
> > message="tns:SendDocumentFault"/>
> >         </operation>
> >     </portType>
> >
> >     <binding name="SendDocumentSOAP"
> > type="tns:SendDocumentPortType">
> >         <soap:binding style="document" transport="
> > http://schemas.xmlsoap.org/soap/http"/>
> >         <operation name="SendDocument">
> >            <soap:operation soapAction="
> >
> http://www.streamserve.com/xml/soap/servicebroker/4.1/senddocument"
>  > style="document" />
> >            <input>
> >                <soap:body use="literal"/>
> >            </input>
> >            <output>
> >                <soap:body use="literal"/>
> >            </output>
> >             <fault name="SendDocumentFault">
> >                 <soap:fault name="SendDocumentFault" use="literal"/>
> >             </fault>
> >         </operation>
> >     </binding>
> >
> >     <binding name="SendReceiveDocumentSOAP"
> > type="tns:SendReceiveDocumentPortType">
> >         <soap:binding style="document" transport="
> > http://schemas.xmlsoap.org/soap/http"/>
> >         <operation name="SendReceiveDocument">
> >            <soap:operation soapAction="
> >
> http://www.streamserve.com/xml/soap/servicebroker/4.1/sendreceivedocument"
> > style="document" />
>  >            <input>
> >                <soap:body use="literal"/>
> >            </input>
> >            <output>
> >                <soap:body use="literal"/>
> >            </output>
> >             <fault name="SendDocumentFault">
> >                 <soap:fault name="SendDocumentFault" use="literal"/>
> >             </fault>
> >         </operation>
> >     </binding>
> >
> >     <service name="StreamServe ServiceBroker">
> >         <documentation>StreamServe ServiceBroker SOAP
> > services.</documentation>
> >         <port name="SendDocumentPort" binding="tns:SendDocumentSOAP">
> >            <soap:address location="http://localhost:1717"/>
> >         </port>
> >         <port name="SendReceiveDocumentPort"
> > binding="tns:SendReceiveDocumentSOAP">
> >            <soap:address location=" http://localhost:1717"/>
> >         </port>
> >
> >     </service>
> >
> > </definitions>
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>

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


Re: Axis 1.4 with soapenc:base64

Posted by Daniel Beland <dc...@gmail.com>.
Hi Anne,

Thanks for the reply but maybe my message was misleading.

The WSDL comes from some other application and is not generated by Axis.
I use axis to generate the java classes to connect to that service.


Now I am wondering if the WSDL is invalid and I should ask the provider to
correct it, or if it is Axis that is not handling the situation properly
when it creates the SOAP message?


I changed the type to xsd:base64Binary and it works perfectly, thanks. In
the meantime this is what I'll do.
The service is expecting binary data so giving it XML would not work (ie: It
could be an excel document or some other file format).

Thanks,
Daniel


On 7/25/06, Anne Thomas Manes <at...@gmail.com> wrote:
>
> Absolutely -- Axis should not be defining the data as soapenc:base64.
> I suggest that you modify the WSDL, replace the type with
> "xsd:base64binary" and regen the service.
>
> Alternatively, you might try sending the XML as XML rather than
> encoding it as binary.
>
> Anne
>
> On 7/25/06, Daniel Beland <dc...@gmail.com> wrote:
> >
> >
> > Hi,
> >
> >
> > I have a problem with axis 1.4, and I am not sure if it is a bug.
> > I need to connect to an application that expose a generic web service.
> > The application is StreamServe, and the web service is meant to be able
> to
> > execute any service since we provide the service name and version in the
> > request.
> >
> > So being generic, the data is defined as soapenc:base64, but the web
> service
> > itself is document literal. (WSDL will follow at the end).
> > I find this combination really odd and I am not sure if it is valid?
> >
> >
> > Here are the details:
> >
> > The server expects the following kind of input:
> >
> >          <SendDocument
> > xmlns="
> http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd
> > ">
> >
> > <ServiceDescription>whprod_service</ServiceDescription>
> >             <ServiceVersion>1</ServiceVersion>
> >             <ServerID></ServerID>
> >
> >
> <DocData>PHRhYmxlPjxzY2hlbWUuc3RvY2ttPjx3YXJlaG91c2U+Q0w8L3dhcmVob3VzZT48cHJvZHVjdD5SVEstMDQjNzExMTAxLUwgICAgIDwvcHJvZHVjdD48L3NjaGVtZS5zdG9ja20+PC90YWJsZT4=</DocData>
> >          </SendDocument>
> >
> >
> > But Axis generates this instead (I removed some DocData elements to
> shorten
> > it):
> >
> >
> >          <SendDocument xmlns="
> > http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd">
> >
> > <ServiceDescription>whprod_service</ServiceDescription>
> >             <ServiceVersion>1</ServiceVersion>
> >             <ServerID></ServerID>
> >             <DocData xsi:type="xsd:byte">60</DocData>
> >             <DocData xsi:type="xsd:byte">116</DocData>
> >             <DocData xsi:type="xsd:byte">97</DocData>
> >             <DocData xsi:type="xsd:byte">98</DocData>
> >          </SendDocument>
> >
> >
> > All I do is this:
> >
> >             String test =
> > "<table><scheme.stockm><warehouse>CL</warehouse><product>RTK-04#711101-L
> >     </product></scheme.stockm></table>";
> >             byte[] array = test.getBytes();
> >             String value = binding.sendDocument("whprod_service", "1",
> "",
> > array);
> >
> >
> > I was able to make it works by changing the type of DocData to
> xs:anyType in
> > the WSDL and encoding the string myself like this:
> >
> >             String test =
> > "<table><scheme.stockm><warehouse>CL</warehouse><product>RTK-04#711101-L
> >     </product></scheme.stockm></table>";
> >             byte[] array = test.getBytes();
> >             String encoded = Base64.encode(array);
> >             String value = binding.sendDocument("whprod_service", "1",
> "",
> > encoded);
> >
> > It gives me this:
> >
> >           <SendDocument
> > xmlns="
> http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd">
> >
> > <ServiceDescription>whprod_service</ServiceDescription>
> >             <ServiceVersion>1</ServiceVersion>
> >             <ServerID></ServerID>
> >             <DocData
> >
> xsi:type="xsd:string">PHRhYmxlPjxzY2hlbWUuc3RvY2ttPjx3YXJlaG91c2U+Q0w8L3dhcmVob3VzZT48cHJvZHVjdD5SVEstMDQjNzExMTAxLUwgICAgIDwvcHJvZHVjdD48L3NjaGVtZS5zdG9ja20+PC90YWJsZT4=</DocData>
> >          </SendDocument>
> >
> >
> > I would like to know if it is a bug in axis, in which case I will open a
> bug
> > in jira or the problem comes from an invalid WSDL (document/literal with
> > soapenc types).
> >
> > Thanks,
> > Daniel
> >
> >
> > Here is the wsdl:
> >
> >
> > <?xml version="1.0" encoding="utf-8" ?>
> > <definitions
> >     elementFormDefault="qualified"
> >     targetNamespace="
> > http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.wsdl"
> >
> > xmlns:tns="
> http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.wsdl
> > "
> >
> > xmlns:sbs="
> http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd"
> >     xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soap/"
> >
> > xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
> >     xmlns:xs=" http://www.w3.org/2001/XMLSchema"
> >     xmlns="http://schemas.xmlsoap.org/wsdl/" >
> >
> >     <types>
> >         <xs:schema elementFormDefault="qualified" targetNamespace="
> > http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd"
> > >
> >            <xs:import namespace="
> > http://www.w3.org/2001/XMLSchema" />
> >            <xs:element name="SendDocument">
> >                <xs:complexType>
> >                   <xs:sequence>
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="ServiceDescription" type="xs:string" />
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="ServiceVersion" type="xs:string" />
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="ServerID" type="xs:string" />
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="DocData" type="soap-enc:base64" />
> >                   </xs:sequence>
> >               </xs:complexType>
> >            </xs:element>
> >                <xs:element name="SendReceiveDocument">
> >                 <xs:complexType>
> >                     <xs:sequence>
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="ServiceDescription" type="xs:string" />
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="ServiceVersion" type="xs:string" />
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="ServerID" type="xs:string" />
> >                         <xs:element minOccurs="1" maxOccurs="1"
> > name="DocData" type="soap-enc:base64" />
> >                     </xs:sequence>
> >                 </xs:complexType>
> >             </xs:element>
> >             <xs:element name="SendDocumentResponse">
> >               <xs:complexType>
> >                   <xs:sequence>
> >                       <xs:element minOccurs="1" maxOccurs="1"
> > name="SendDocumentResult" type="xs:string" />
> >                   </xs:sequence>
> >               </xs:complexType>
> >            </xs:element>
> >            <xs:element name="SendReceiveDocumentResponse">
> >               <xs:complexType>
> >                   <xs:sequence>
> >                       <xs:element minOccurs="1" maxOccurs="1"
> > name="SendReceiveDocumentResult" type="xs:string" />
> >                       <xs:element minOccurs="1" maxOccurs="1"
> name="DocData"
> > type="soap-enc:base64" />
> >                   </xs:sequence>
> >               </xs:complexType>
> >            </xs:element>
> >            <xs:element name="SendDocumentFault">
> >               <xs:complexType>
> >                   <xs:sequence>
> >                       <xs:element minOccurs="0" maxOccurs="1"
> > name="ErrorCode" type="xs:string" />
> >                       <xs:element minOccurs="0" maxOccurs="1"
> > name="ErrorDescription" type="xs:string" />
> >                   </xs:sequence>
> >               </xs:complexType>
> >            </xs:element>
> >        </xs:schema>
> >     </types>
> >
> >     <message name="SendDocumentIn">
> >         <part name="parameters" element="sbs:SendDocument"/>
> >     </message>
> >
> >     <message name="SendReceiveDocumentIn">
> >         <part name="parameters"
> > element="sbs:SendReceiveDocument"/>
> >     </message>
> >     <message name="SendDocumentOut">
> >         <part name="parameters"
> > element="sbs:SendDocumentResponse"/>
> >     </message>
> >     <message name="SendReceiveDocumentOut">
> >         <part name="parameters"
> > element="sbs:SendReceiveDocumentResponse"/>
> >     </message>
> >     <message name="SendDocumentFault">
> >         <part name="parameters"
> > element="sbs:SendDocumentFault"/>
> >     </message>
> >
> >     <portType name="SendDocumentPortType">
> >         <operation name="SendDocument">
> >             <documentation>
> >             Sends a document to ServiceBroker for processing.
> >             ServiceDescription:    The name of the service to execute.
> >             ServiceVersion:    The service version to use. This
> parameter
> > can be empty, indicating that the latest registered service should be
> used.
> >             DocData: A byte array with data sent to the service
> specified in
> > ServiceDescription.
> >             Return:    Parameter reserved for future use.
> >             </documentation>
> >             <input message="tns:SendDocumentIn"/>
> >             <output message="tns:SendDocumentOut"/>
> >             <fault name="SendDocumentFault"
> > message="tns:SendDocumentFault"/>
> >         </operation>
> >     </portType>
> >
> >     <portType name="SendReceiveDocumentPortType">
> >         <operation name="SendReceiveDocument">
> >             <documentation>
> >             Sends a document to ServiceBroker for processing. The result
> > will be returned to the caller.
> >             ServiceDescription:    The name of the service to execute.
> >             ServiceVersion:    The service version to use. This
> parameter
> > can be empty, indicating that the latest registered service should be
> used.
> >             DocData: [in] A byte array with data sent to the service
> > specified in ServiceDescription. [out] A byte array with the result.
> >             Return:    Parameter reserved for future use.
> >             </documentation>
> >             <input message="tns:SendReceiveDocumentIn"/>
> >             <output message="tns:SendReceiveDocumentOut"/>
> >             <fault name="SendDocumentFault"
> > message="tns:SendDocumentFault"/>
> >         </operation>
> >     </portType>
> >
> >     <binding name="SendDocumentSOAP"
> > type="tns:SendDocumentPortType">
> >         <soap:binding style="document" transport="
> > http://schemas.xmlsoap.org/soap/http"/>
> >         <operation name="SendDocument">
> >            <soap:operation soapAction="
> > http://www.streamserve.com/xml/soap/servicebroker/4.1/senddocument"
> > style="document" />
> >            <input>
> >                <soap:body use="literal"/>
> >            </input>
> >            <output>
> >                <soap:body use="literal"/>
> >            </output>
> >             <fault name="SendDocumentFault">
> >                 <soap:fault name="SendDocumentFault" use="literal"/>
> >             </fault>
> >         </operation>
> >     </binding>
> >
> >     <binding name="SendReceiveDocumentSOAP"
> > type="tns:SendReceiveDocumentPortType">
> >         <soap:binding style="document" transport="
> > http://schemas.xmlsoap.org/soap/http"/>
> >         <operation name="SendReceiveDocument">
> >            <soap:operation soapAction="
> >
> http://www.streamserve.com/xml/soap/servicebroker/4.1/sendreceivedocument"
> > style="document" />
> >            <input>
> >                <soap:body use="literal"/>
> >            </input>
> >            <output>
> >                <soap:body use="literal"/>
> >            </output>
> >             <fault name="SendDocumentFault">
> >                 <soap:fault name="SendDocumentFault" use="literal"/>
> >             </fault>
> >         </operation>
> >     </binding>
> >
> >     <service name="StreamServe ServiceBroker">
> >         <documentation>StreamServe ServiceBroker SOAP
> > services.</documentation>
> >         <port name="SendDocumentPort" binding="tns:SendDocumentSOAP">
> >            <soap:address location="http://localhost:1717"/>
> >         </port>
> >         <port name="SendReceiveDocumentPort"
> > binding="tns:SendReceiveDocumentSOAP">
> >            <soap:address location="http://localhost:1717"/>
> >         </port>
> >
> >     </service>
> >
> > </definitions>
> >
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>

Re: Axis 1.4 with soapenc:base64

Posted by Anne Thomas Manes <at...@gmail.com>.
Absolutely -- Axis should not be defining the data as soapenc:base64.
I suggest that you modify the WSDL, replace the type with
"xsd:base64binary" and regen the service.

Alternatively, you might try sending the XML as XML rather than
encoding it as binary.

Anne

On 7/25/06, Daniel Beland <dc...@gmail.com> wrote:
>
>
> Hi,
>
>
> I have a problem with axis 1.4, and I am not sure if it is a bug.
> I need to connect to an application that expose a generic web service.
> The application is StreamServe, and the web service is meant to be able to
> execute any service since we provide the service name and version in the
> request.
>
> So being generic, the data is defined as soapenc:base64, but the web service
> itself is document literal. (WSDL will follow at the end).
> I find this combination really odd and I am not sure if it is valid?
>
>
> Here are the details:
>
> The server expects the following kind of input:
>
>          <SendDocument
> xmlns="http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd
> ">
>
> <ServiceDescription>whprod_service</ServiceDescription>
>             <ServiceVersion>1</ServiceVersion>
>             <ServerID></ServerID>
>
> <DocData>PHRhYmxlPjxzY2hlbWUuc3RvY2ttPjx3YXJlaG91c2U+Q0w8L3dhcmVob3VzZT48cHJvZHVjdD5SVEstMDQjNzExMTAxLUwgICAgIDwvcHJvZHVjdD48L3NjaGVtZS5zdG9ja20+PC90YWJsZT4=</DocData>
>          </SendDocument>
>
>
> But Axis generates this instead (I removed some DocData elements to shorten
> it):
>
>
>          <SendDocument xmlns="
> http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd">
>
> <ServiceDescription>whprod_service</ServiceDescription>
>             <ServiceVersion>1</ServiceVersion>
>             <ServerID></ServerID>
>             <DocData xsi:type="xsd:byte">60</DocData>
>             <DocData xsi:type="xsd:byte">116</DocData>
>             <DocData xsi:type="xsd:byte">97</DocData>
>             <DocData xsi:type="xsd:byte">98</DocData>
>          </SendDocument>
>
>
> All I do is this:
>
>             String test =
> "<table><scheme.stockm><warehouse>CL</warehouse><product>RTK-04#711101-L
>     </product></scheme.stockm></table>";
>             byte[] array = test.getBytes();
>             String value = binding.sendDocument("whprod_service", "1", "",
> array);
>
>
> I was able to make it works by changing the type of DocData to xs:anyType in
> the WSDL and encoding the string myself like this:
>
>             String test =
> "<table><scheme.stockm><warehouse>CL</warehouse><product>RTK-04#711101-L
>     </product></scheme.stockm></table>";
>             byte[] array = test.getBytes();
>             String encoded = Base64.encode(array);
>             String value = binding.sendDocument("whprod_service", "1", "",
> encoded);
>
> It gives me this:
>
>           <SendDocument
> xmlns="http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd">
>
> <ServiceDescription>whprod_service</ServiceDescription>
>             <ServiceVersion>1</ServiceVersion>
>             <ServerID></ServerID>
>             <DocData
> xsi:type="xsd:string">PHRhYmxlPjxzY2hlbWUuc3RvY2ttPjx3YXJlaG91c2U+Q0w8L3dhcmVob3VzZT48cHJvZHVjdD5SVEstMDQjNzExMTAxLUwgICAgIDwvcHJvZHVjdD48L3NjaGVtZS5zdG9ja20+PC90YWJsZT4=</DocData>
>          </SendDocument>
>
>
> I would like to know if it is a bug in axis, in which case I will open a bug
> in jira or the problem comes from an invalid WSDL (document/literal with
> soapenc types).
>
> Thanks,
> Daniel
>
>
> Here is the wsdl:
>
>
> <?xml version="1.0" encoding="utf-8" ?>
> <definitions
>     elementFormDefault="qualified"
>     targetNamespace="
> http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.wsdl"
>
> xmlns:tns="http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.wsdl
> "
>
> xmlns:sbs="http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd"
>     xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soap/"
>
> xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
>     xmlns:xs=" http://www.w3.org/2001/XMLSchema"
>     xmlns="http://schemas.xmlsoap.org/wsdl/" >
>
>     <types>
>         <xs:schema elementFormDefault="qualified" targetNamespace="
> http://schemas.streamserve.com/xml/wsdl/servicebroker/4.1/services.xsd"
> >
>            <xs:import namespace="
> http://www.w3.org/2001/XMLSchema" />
>            <xs:element name="SendDocument">
>                <xs:complexType>
>                   <xs:sequence>
>                         <xs:element minOccurs="1" maxOccurs="1"
> name="ServiceDescription" type="xs:string" />
>                         <xs:element minOccurs="1" maxOccurs="1"
> name="ServiceVersion" type="xs:string" />
>                         <xs:element minOccurs="1" maxOccurs="1"
> name="ServerID" type="xs:string" />
>                         <xs:element minOccurs="1" maxOccurs="1"
> name="DocData" type="soap-enc:base64" />
>                   </xs:sequence>
>               </xs:complexType>
>            </xs:element>
>                <xs:element name="SendReceiveDocument">
>                 <xs:complexType>
>                     <xs:sequence>
>                         <xs:element minOccurs="1" maxOccurs="1"
> name="ServiceDescription" type="xs:string" />
>                         <xs:element minOccurs="1" maxOccurs="1"
> name="ServiceVersion" type="xs:string" />
>                         <xs:element minOccurs="1" maxOccurs="1"
> name="ServerID" type="xs:string" />
>                         <xs:element minOccurs="1" maxOccurs="1"
> name="DocData" type="soap-enc:base64" />
>                     </xs:sequence>
>                 </xs:complexType>
>             </xs:element>
>             <xs:element name="SendDocumentResponse">
>               <xs:complexType>
>                   <xs:sequence>
>                       <xs:element minOccurs="1" maxOccurs="1"
> name="SendDocumentResult" type="xs:string" />
>                   </xs:sequence>
>               </xs:complexType>
>            </xs:element>
>            <xs:element name="SendReceiveDocumentResponse">
>               <xs:complexType>
>                   <xs:sequence>
>                       <xs:element minOccurs="1" maxOccurs="1"
> name="SendReceiveDocumentResult" type="xs:string" />
>                       <xs:element minOccurs="1" maxOccurs="1" name="DocData"
> type="soap-enc:base64" />
>                   </xs:sequence>
>               </xs:complexType>
>            </xs:element>
>            <xs:element name="SendDocumentFault">
>               <xs:complexType>
>                   <xs:sequence>
>                       <xs:element minOccurs="0" maxOccurs="1"
> name="ErrorCode" type="xs:string" />
>                       <xs:element minOccurs="0" maxOccurs="1"
> name="ErrorDescription" type="xs:string" />
>                   </xs:sequence>
>               </xs:complexType>
>            </xs:element>
>        </xs:schema>
>     </types>
>
>     <message name="SendDocumentIn">
>         <part name="parameters" element="sbs:SendDocument"/>
>     </message>
>
>     <message name="SendReceiveDocumentIn">
>         <part name="parameters"
> element="sbs:SendReceiveDocument"/>
>     </message>
>     <message name="SendDocumentOut">
>         <part name="parameters"
> element="sbs:SendDocumentResponse"/>
>     </message>
>     <message name="SendReceiveDocumentOut">
>         <part name="parameters"
> element="sbs:SendReceiveDocumentResponse"/>
>     </message>
>     <message name="SendDocumentFault">
>         <part name="parameters"
> element="sbs:SendDocumentFault"/>
>     </message>
>
>     <portType name="SendDocumentPortType">
>         <operation name="SendDocument">
>             <documentation>
>             Sends a document to ServiceBroker for processing.
>             ServiceDescription:    The name of the service to execute.
>             ServiceVersion:    The service version to use. This parameter
> can be empty, indicating that the latest registered service should be used.
>             DocData: A byte array with data sent to the service specified in
> ServiceDescription.
>             Return:    Parameter reserved for future use.
>             </documentation>
>             <input message="tns:SendDocumentIn"/>
>             <output message="tns:SendDocumentOut"/>
>             <fault name="SendDocumentFault"
> message="tns:SendDocumentFault"/>
>         </operation>
>     </portType>
>
>     <portType name="SendReceiveDocumentPortType">
>         <operation name="SendReceiveDocument">
>             <documentation>
>             Sends a document to ServiceBroker for processing. The result
> will be returned to the caller.
>             ServiceDescription:    The name of the service to execute.
>             ServiceVersion:    The service version to use. This parameter
> can be empty, indicating that the latest registered service should be used.
>             DocData: [in] A byte array with data sent to the service
> specified in ServiceDescription. [out] A byte array with the result.
>             Return:    Parameter reserved for future use.
>             </documentation>
>             <input message="tns:SendReceiveDocumentIn"/>
>             <output message="tns:SendReceiveDocumentOut"/>
>             <fault name="SendDocumentFault"
> message="tns:SendDocumentFault"/>
>         </operation>
>     </portType>
>
>     <binding name="SendDocumentSOAP"
> type="tns:SendDocumentPortType">
>         <soap:binding style="document" transport="
> http://schemas.xmlsoap.org/soap/http"/>
>         <operation name="SendDocument">
>            <soap:operation soapAction="
> http://www.streamserve.com/xml/soap/servicebroker/4.1/senddocument"
> style="document" />
>            <input>
>                <soap:body use="literal"/>
>            </input>
>            <output>
>                <soap:body use="literal"/>
>            </output>
>             <fault name="SendDocumentFault">
>                 <soap:fault name="SendDocumentFault" use="literal"/>
>             </fault>
>         </operation>
>     </binding>
>
>     <binding name="SendReceiveDocumentSOAP"
> type="tns:SendReceiveDocumentPortType">
>         <soap:binding style="document" transport="
> http://schemas.xmlsoap.org/soap/http"/>
>         <operation name="SendReceiveDocument">
>            <soap:operation soapAction="
> http://www.streamserve.com/xml/soap/servicebroker/4.1/sendreceivedocument"
> style="document" />
>            <input>
>                <soap:body use="literal"/>
>            </input>
>            <output>
>                <soap:body use="literal"/>
>            </output>
>             <fault name="SendDocumentFault">
>                 <soap:fault name="SendDocumentFault" use="literal"/>
>             </fault>
>         </operation>
>     </binding>
>
>     <service name="StreamServe ServiceBroker">
>         <documentation>StreamServe ServiceBroker SOAP
> services.</documentation>
>         <port name="SendDocumentPort" binding="tns:SendDocumentSOAP">
>            <soap:address location="http://localhost:1717"/>
>         </port>
>         <port name="SendReceiveDocumentPort"
> binding="tns:SendReceiveDocumentSOAP">
>            <soap:address location="http://localhost:1717"/>
>         </port>
>
>     </service>
>
> </definitions>
>
>
>

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