Announcement Announcement Module
No announcement yet.
Getting unexpected encoding when calling RPC/encoded style webservice using Springws Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Getting unexpected encoding when calling RPC/encoded style webservice using Springws


    I am trying to consume a RPC/encoded style webservice using SPring ws client ie. webservicetemplate. I dont have any information of this webservice other than wsdl. But i am not able to figure out how to form the request xml.

    Below is the code and exception i am getting:

    <?xml version="1.0" encoding="utf-8"?>
    <ldap:authenticate xmlns:ldap="">

    This i framed based on following soapUI request which is currently retrieving correct response.

    <soapenv:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soapenv="" xmlns:ldap="">
    <ldap:authenticate soapenv:encodingStyle="">
    <String_1 xsi:type="xsd:string">username</String_1>
    <String_2 xsi:type="xsd:string">password</String_2>
    <String_3 xsi:type="xsd:string">ALL</String_3>

    if username and password are replaced by exact values.

    Here is the SoapResponse:
    <env:Envelope env:encodingStyle="" xmlns:env="" xmlns:xsd="" xmlns:xsi="" xmlns:enc="" xmlns:ns0="">
    <ans1:authenticateResponse xmlns:ans1="">
    <result xsi:type="xsd:string">0:Contractors</result>

    This is my

    public class Client extends WebServiceGatewaySupport{

    public void run() throws JAXBException {
    try {
    StreamSource src = new StreamSource(new FileInputStream("src/request.xml"));
    StreamResult res = new StreamResult(System.out);
    getWebServiceTemplate().sendSourceAndReceiveToResu lt(src, res);

    } catch (Exception e) {


    * @param args
    public static void main(String[] args) throws JAXBException{
    ApplicationContext app = new ClassPathXmlApplicationContext(
    new String[] { "appContext.xml" });
    Client c = (Client) app


    Here is the output: Exception: JAXRPCTIE01: caught exception while handling request: unexpected encoding style: expected=, actual=
    at essageResolver.resolveFault(SoapFaultMessageResolv
    at ate.handleFault(
    at ate.doSendAndReceive(
    at ate.sendAndReceive(
    at ate.doSendAndReceive(
    at ate.sendSourceAndReceiveToResult(WebServiceTemplat
    at ate.sendSourceAndReceiveToResult(WebServiceTemplat

    When i include a clientInterceptor and try to print SoapMessage in HandleRequest() method if prints...soapmessage as
    soap mesg req--SaajSoapMessage {}authenticate. Its not bounded with Soap envelope elements as expected. Also it is looking at some kind of encoding style needs to be sent as part of my request.

    Please let me know how to send correct request xml.

    Any kind of help is much appreciated.


  • #2

    Been there, done that. Spring-WS uses marshalling libraries (e.g. JAXB2) to create requests and unmarshall responses. RPC/Encoded is deprecated (according to WS-I) style of web services implemented by old JAX-RPC compliant libraries (e.g. Axis1, Sun's JAX-RPC RI).

    I've tried to rip unmarshalling code from Axis (BeanDeserializers), but there were many problems. So without much changes to Spring-WS you should use Axis 1.4...

    Grzegorz Grzybek


    • #3

      Hi Grzegorz,

      Thanks for the response. Yes i was successful in generating client using JAX-RPC. But our requirement is to reimplement this using Spring-ws. Now i am much clear with your answer.


      • #4

        I finally could create a Spring client using Axis and JAXRPC.

        Here is my appcontext.xml.

        <bean id="ldapService" class="org.springframework.remoting.jaxrpc.JaxRpcP ortProxyFactoryBean">

        <property name="serviceFactoryClass">

        <property name="wsdlDocumentUrl">

        <property name="namespaceUri">

        <property name="serviceName">

        <property name="portName">

        <property name="portInterface">

        <property name="serviceInterface">


        This worked fine on Tomcat. Again i am facing pb when it is deployed on JBOSS.
        I am getting below stack trace on JBOSS:

        SEVERE: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.apache.axis.message.MessageElement.getChildEl ements(Ljavax/xml/namespace/QNameLjava/util/Iterator;" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, org/apache/axis/message/MessageElement, and the class loader (instance of <bootloader>) for interface javax/xml/soap/SOAPElement have different Class objects for the type javax/xml/namespace/QName used in the signature
        at org.apache.axis.client.Call.invoke(
        at org.apache.axis.client.Call.invoke(
        at org.apache.axis.client.AxisClientProxy.invoke(Axis
        at $Proxy118.authenticate(Unknown Source)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Native
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
        at java.lang.reflect.Method.invoke(
        at org.springframework.remoting.rmi.RmiClientIntercep torUtils.invokeRemoteMethod(RmiClientInterceptorUt
        at org.springframework.remoting.jaxrpc.JaxRpcPortClie ntInterceptor.doInvoke(JaxRpcPortClientInterceptor .java:617)
        at org.springframework.remoting.jaxrpc.JaxRpcPortClie ntInterceptor.doInvoke(JaxRpcPortClientInterceptor .java:584)
        at org.springframework.remoting.jaxrpc.JaxRpcPortClie ntInterceptor.invoke(JaxRpcPortClientInterceptor.j ava:562)
        at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed( :171)
        at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(
        at $Proxy119.authenticate(Unknown Source)

        As i need my client to be deployed on JBOSS as our application needs to be running on JBOSS. Please help me resolving above conflict.

        Appreciate your help.



        • #5

          It was just some JBOSS jars conflicting with jaxrpc.jar i included in web-inf/lib.
          Deleting this solved the issue.