You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Alexander Reifinger <Al...@Reifinger.de> on 2002/04/09 09:42:54 UTC

RE: Looking for info how to deserialize Base64Binary

Joe, thank you so much, your hint worked the snatch in my brain!

What you suggested did not work, but with some small modifications I can now
see my daily Dilbert!

SOAPMappingRegistry smr = new SOAPMappingRegistry();
BeanSerializer beanSer = new BeanSerializer();
StringDeserializer stringSer = new StringDeserializer();
smr.mapTypes(Constants.NS_URI_SOAP_ENC,
		 new org.apache.soap.util.xml.QName("http://tempuri.org/",
"DailyDilbertImageResult"),
		 String.class,
		 beanSer, stringSer
		);
Call call=new Call();
call.setSOAPMappingRegistry(smr);
call.setTargetObjectURI("DailyDilbert");
call.setMethodName("DailyDilbertImage");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Response response=call.invoke(
  new URL("http://www.esynaps.com/WebServices/DailyDiblert.asmx"),
  "http://tempuri.org/DailyDilbertImage"
);

if(response.generatedFault()) {
  throw new ServiceUnavailableException(response.getFault().toString());
} else {
  Parameter respParam=response.getReturnValue();
  if(respParam.getValue()!=null) {
    return new Base64().decode((String)respParam.getValue());
  } else {
    throw new ServiceUnavailableException("Function did not return a
value!");
  }
}

Why is it that I always have to give a serializer, too. This is of no use on
the client, as well as giving a deserializer on the server?

Anyway, I quickly added a new Service call QuoteOfTheDay, which took about 1
minute of copy&paste, so I've got something to present now.

Again, thank you very much,
Alexander