Hello list.

    I've developed a Web Service with JAXWS on Java JDK 1.6. I have a
.NET Client and a C(gSOAP) client. This web service contains a method
that returns a byte array (byte[]). These bytes has to be stored on a
file. The problem is that with the .NET client the bytes array are saved
correctly on file, however using gSOAP Client the bytes aren't saved on
file correctly.

Java Web Serive:
@WebMethod(operationName="GetLicenceInstallation")
     public byte[] getLicenceInstalation(
             @WebParam(name="customer_code")String customer_code,
             @WebParam(name="customer_passwd")String customer_passwd,
             @WebParam(name="customer_mail")String customer_mail,
             @WebParam(name="licence_type_code")String licence_type_code,
             @WebParam(name="fields")byte[] fields) {

         return this.facade.activateLicence(licence_type_code,
customer_code, customer_passwd, customer_mail, fields);
     }
GSOAP generates that:

/// Built-in type "xs:base64Binary".
struct xsd__base64Binary
{    unsigned char *__ptr;
     int __size;
     char *id, *type, *options; // NOTE: for DIME and MTOM XOP
attachments only
};


/// "http://controller.gmsoft.com/":GetLicenceInstallationResponse is a
complexType.
struct ws1__GetLicenceInstallationResponse
{
/// Element return of type xs:base64Binary.
     struct xsd__base64Binary*            return_                       
0;    ///< Nullable pointer.
};

My C Client save these "bytes" to file as:

      struct soap soap;
      struct ws1__GetLicenceInstallation request;
      struct ws1__GetLicenceInstallationResponse response;

      request.customer_x005fcode = "XXXX";
      request.customer_x005fmail = "[email protected]";
      request.customer_x005fpasswd = "XXXXX";
      request.licence_x005ftype_x005fcode = "XXXXXXX";

      soap_init(&soap);
      soap_call___ws1__GetLicenceInstallation(&soap, server, "",
&request, &response);
      soap_destroy(&soap);
      soap_end(&soap);
      soap_done(&soap);

      char* licence_filename = "licence.lcc";
      FILE* licence_stream;
      licence_stream = fopen(licence_filename, "w+");

      fwrite(response.return_->__ptr, sizeof(unsigned char),
response.return_->__size, licence_stream);

      fclose(licence_stream);
The lenght of the two files (.NET and gSOAP) is the same, 260 bytes.
However, the content is different. I think that the probleam is around
the byte <-> char codification.

Can you help me, please?
Thanks for all.

Reply via email to