• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Deserialization Exception while using string[]

 
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using dynamic stubs to invoke web service that returns String[].

I am having the problem:

javax.xml.rpc.JAXRPCException: failed to invoke operation 'getXXX' due to an error in the soap layer (SAAJ); nested exception is: Message[failed to deserialize xml:weblogic.xml.schema.binding.DeserializationException: mapping lookup failure for xml type ['java:language_builtins.lang']:ArrayOfString and java interface javax.xml.soap.SOAPElement]StackTrace[


Here is the code:
System.setProperty("javax.xml.soap.MessageFactory",
"weblogic.webservice.core.soap.MessageFactoryImpl");
// Setup the global JAX-RPC service factory
System.setProperty( "javax.xml.rpc.ServiceFactory",
"weblogic.webservice.core.rpc.ServiceFactoryImpl");

// create service factory
ServiceFactory factory = ServiceFactory.newInstance();

// define qnames
String targetNamespace = "http://localhost:7001/SaWS";

QName serviceName =
new QName(targetNamespace,
"SarWSServiceName");

QName portName =
new QName(targetNamespace,
"SaWSServiceNamePort");

QName operationName = new QName(targetNamespace,
"getXXX");

URL wsdlLocation =
new URL("http://localhost:7001/SaWS/SaWSURI?wsdl");

// create service
Service service = factory.createService(wsdlLocation, serviceName);

Call call = service.createCall(portName, operationName);

TypeMappingRegistry registry = service.getTypeMappingRegistry();

TypeMapping typemapping = registry.getTypeMapping(SOAPConstants.URI_NS_SOAP_ENCODING);

typemapping.register(
java.lang.String[].class,
new QName("http://www.w3.org/2001/XMLSchema", "ArrayOfString"),
new language_builtins.lang.ArrayOfStringCodec(),
new language_builtins.lang.ArrayOfStringCodec()
);

String cust_number = "40230505";
Object[] res = (Object[]) call.invoke(new Object[]{cust_number} );
System.out.println( "res.length : " + res.length );
 
reply
    Bookmark Topic Watch Topic
  • New Topic