1 Reply Latest reply on Sep 22, 2004 3:35 AM by Thomas Diesler

    J2EE calling .NET web service for base64Binary element - SAA

    Kent Reynolds Newbie

      I am trying to save to disk a binary file from a .NET webservice. This service is simply a pilot so I wrote the .NET webservice to reply with a base64binary element (byte[]) instead of DIME or SWA.

      <s:element minOccurs="0" maxOccurs="1" name="GetApplicationResult" type="s:base64Binary" />

      However, when I go to get the GetApplicationResult element using SAAJ:

      ...

      Iterator sbes = child.getChildElements(nameApplicationExistsResult);
      while(sbes.hasNext()){
      child = (SOAPElement)sbes.next();
      sLogger.debug("Name: " + sName + " | Value: " + child.getValue());
      }

      ...

      I am only returned the binary string data until the first carriage return.


      [java] 12:59:54,565 DEBUG [CHL_Appender]

      Name: GetApplicationResult
      Value: JVBERi0xLjMNJeLjz9MNCjE5OCAwIG9iag08PCANL0xpbmVhcml6ZWQgMSANL08gMjAwIA0vSCBb


      Here is the entire serialized response message i was parsing:

      <?xml version="1.0" encoding="utf-8"?>
      <soap:Envelope
      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <soap:Body>
      &lt;GetApplicationResponse xmlns="urn:chl">
      &lt;GetApplicationResult>JVBERi0xLjMNJeLjz9MNCjE5OCAwIG9iag08PCANL0xpbmVhcml6ZWQgMSANL08gMjAwIA0vSCBb IDEyMDggNTcxIF0gDS9MIDI1MTUxNTMgDS9FIDg3NDQwIA0vTiA2MCANL1QgMjUxMTA3NCANPj4g CjAwMDI1MDk0MDYgMDAwMDAgbg0KMDAwMjUwOTU2NSAwMDAwMCBuDQowMDAyNTA5NzI0IDAwMDAw IG4NCjAwMDI1MDk5NTAgMDAwMDAgbg0KdHJhaWxlcg08PA0vU2l6ZSAxOTgNL0lEWzxkNWU0MWIx YmQ4MzRkYmI1NWQ3NmRhZjNiOGQ0OTQxZj48NWJmMzcxMmU1NjZhYmZkNDhlMGZhNTBmZDNmOGU3
      NTg+XQ0+Pg1zdGFydHhyZWYNMTczDSUlRU9GDQ==
      &lt;/GetApplicationResult>
      &lt;/GetApplicationResponse>
      </soap:Body>
      </soap:Envelope>

      Do I need to make changes on the .NET side? What should I use instead of getValue on the SOAP Element to obtain the entire binary data? Note that the Encoding Style is initially null, but when I set it to: xs:base64Binary on the JAVA side before I call get value it does not help.

      Thanks,

      Kent