Aegis problems migrating from xfire

View: New views
2 Messages — Rating Filter:   Alert me  

Aegis problems migrating from xfire

by MattJax :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi

I am migrating a project from xfire-1.2.6 to CXF 2.1.1 and JDK1.5.0_15.

I cannot get the CXF client code to use my aegis mappings at all.  I've tried a number of different ways to generate my client as follows:

My interface for the Web Service is:

public interface IPartners {
        public LoginResult Login(String username, String password);
}

The IPartners.aegis.xml file (in the same directory)

<mappings xmlns="the_namespace">
        <mapping>
                <method name="Login">
                        <parameter index="0" mappedName="username"/>
            <parameter index="1" mappedName="password"/>
    <return-type name="LoginResult"/>
                </method>
        </mapping>
</mappings>

=========================
Client code - version 1
----------------------
String nameSpace = "the_namespace";
String wsdlURL = "address_I_am_using";
QName endpoint = new QName(nameSpace, "Login");

ClientProxyFactoryBean factory1 = new ClientProxyFactoryBean();
factory1.setServiceClass(IPartners.class);
factory1.setAddress(wsdlURL);
factory1.getServiceFactory().setDataBinding(new AegisDatabinding());
factory1.setServiceName(endpoint);
IPartners partnersWS = (IPartners)factory1.create();
LoginResult lr = partnersWS.Login("username", "password");

This does not respect the aegis file to generate the SOAP message - it produces the following:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
 <soap:Body>
  <ns1:Login xmlns:ns1="the_namespace">
   <ns1:arg0>username</ns1:arg0>
   <ns1:arg1>password</ns1:arg1>
  </ns1:Login>
 </soap:Body>
</soap:Envelope>

note the "arg0" and "arg1" rather than "username" and "password"

Strangely, if I change the aegis file so that it does not conform to the XSD, it does complain that it is in invalid format.

=========================
Client code - version 2
----------------------
String nameSpace = "the_namespace";
String wsdlURL = "address_I_am_using";
QName endpoint = new QName(nameSpace, "Login");

JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getServiceFactory().setDataBinding(new AegisDatabinding());
factory.setServiceClass(IPartners.class);
factory.setAddress(wsdlURL);
factory.setEndpointName(endpoint);
IPartners partnersWS = (IPartners)factory.create();
LoginResult lr = partnersWS.Login("username", "password");

This time, I get the following exception:

javax.xml.ws.WebServiceException: Could not find wsdl:binding operation info for web method Login.


Now then, after playing around with many many different configurations, I have found that if I start annotating the interface, I can remove the aegis mapping file altogether and get the SOAP message I want!  If I remove the line where the AegisDatabinding() is set, it does not work though.

@WebService(targetNamespace="the_namespace")
public interface IPartners {
        @WebMethod(action="the_namespace/Login")
        public @WebResult(name="LoginResult") LoginResult Login(@WebParam(name="username") String username, @WebParam(name="password") String password);
}


So, I can make it work, by abandoning the aegis descriptors, annotating the service interface and using the JaxWsProxyFactoryBean and setting the AegisDatabinding().  This seems to be a little hacked!

I'm sure I must be missing something really obvious.  I have played with this for days to get to the ad hoc situation I'm in now.  Any pointers from anyone would be great!

Thanks in advance.

Matt

Re: Aegis problems migrating from xfire

by MattJax :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Apologies!  I have posted this on the wrong mailing list.

Matt
LightInTheBox - Buy quality products at wholesale price!