I developed my customer service by 2 way and I had the same result.
First method:
import java.io.Serializable;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.cxf.configuration.jsse.TLSClientParameters;
import org.apache.cxf.endpoint.Client;
import org.apache.cxf.frontend.ClientProxy;
import org.apache.cxf.frontend.ClientProxyFactoryBean;
import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
import org.apache.cxf.transport.http.HTTPConduit;
import org.apache.cxf.transports.http.configuration.HTTPClientPolicy;
public class WebServicesUsed implements Serializable {
public final static Log log = LogFactory.getLog(WebServicesUsed.class);
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
public final static Log LOG = LogFactory.getLog(WebServicesUsed.class);
public static void proxyHttpSetProperty() {
System.setProperty("http.proxyHost", "myhttpproxyHost");
System.setProperty("http.proxyPort", "myhttpproxyPort");
}
public static void proxyHttpsSetProperty() {
System.setProperty("https.proxyHost", "myhttpsproxyHost");
System.setProperty("https.proxyPort", "myhttpsproxyPort");
}
private static void configHttpConduit(Object service) {
Client clientProxy = ClientProxy.getClient(service);
HTTPConduit httpConduit = (HTTPConduit) clientProxy.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setConnectionTimeout(0);
httpClientPolicy.setAllowChunking(false);
httpClientPolicy.setReceiveTimeout(0);
httpConduit.setClient(httpClientPolicy);
String targetAddr = httpConduit.getTarget().getAddress().getValue();
if (targetAddr.toLowerCase().startsWith("https:")) {
TrustManager[] simpleTrustManager = new TrustManager[] { new X509TrustManager()
{
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(
java.security.cert.X509Certificate[] certs,
String authType) {
}
public void checkServerTrusted(
java.security.cert.X509Certificate[] certs,
String authType) {
}
} };
TLSClientParameters tlsParams = new TLSClientParameters();
tlsParams.setDisableCNCheck(true);
tlsParams.setSecureSocketProtocol("SSL");
tlsParams.setTrustManagers(simpleTrustManager);
httpConduit.setTlsClientParameters(tlsParams);
}
}
public static void wsTraitmentAcces(String serviceKey) {
try {
/* Configure proxy */
proxyHttpSetProperty();
proxyHttpsSetProperty();
/* Configure client */
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setServiceClass(MyRemoteServices.class);
String url = "https://myserveradress/webservices/MyRemoteServices";
factory.setAddress(url);
MyRemoteServices client = (MyRemoteServices) factory.create();
/* Configure client SSL */
configHttpConduit(client);
LOG.info("Contacter mon service : " + MyRemoteServices.class);
String sessionID = client.connect("168C3754-800E-FE4F-3160-C8E0B593CE2C");
LOG.info("sessionID : " + sessionID);
} catch (Exception e) {
LOG.error(" [ Probleme de connexion au service ] => "
+ e.getLocalizedMessage());
}
}
public static void main(String[] args) {
wsTraitmentAcces("168C3754-800E-FE4F-3160-C8E0B593CE2C");
}
}
The second method:
I dont use Aegis, but get a WSDL out and run a wsdl2java with maven plugin.
Client after wsdl2java :
try {
/* Configure proxy */
atosProxyHttpSetProperty();
atosProxyHttpsSetProperty();
/* Configure client */
MyRemoteServices service = new MyRemoteServices();
MyRemoteServicesPortType client = service.getMyRemoteServicesHttpPort();
/* Configure client SSL */
configHttpConduit(client);
LOG.info("Contacter mon service : " + MyRemoteServices.class);
String sessionID = client.connect("");
LOG.info("sessionID : " + sessionID);
} catch (Exception e) {
LOG.error(" [ Probleme de connexion au service ] => "
+ e.getLocalizedMessage());
}
}
public static void main(String[] args) {
wsTraitmentAcces("168C3754-800E-FE4F-3160-C8E0B593CE2C");
}
My WSDL :
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://webservices.ccm.mm.atos.net"
xmlns:tns="http://webservices.ccm.mm.atos.net"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soap12="http://www.w3.org/2003/05/soap-envelope"
xmlns:ns1="http://common.ccm.mm.atos.net"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc11="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soapenc12="http://www.w3.org/2003/05/soap-encoding"
xmlns:ns2="http://exceptions.ccm.mm.atos.net"
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://webservices.ccm.mm.atos.net">
<xsd:element name="connect">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="connectResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="PermissionDeniedException"
type="ns1:PermissionDeniedException"/>
<xsd:element name="disconnect">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="disconnectResponse">
<xsd:complexType/>
</xsd:element>
<xsd:element name="accesFileCounters">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="in0" nillable="true"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="in1" nillable="true"
type="xsd:string"/>
<xsd:element maxOccurs="1" minOccurs="1" name="in2" nillable="true"
type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:complexType name="FileCounters">
<xsd:sequence>
<xsd:element minOccurs="0" name="available" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="busy" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="canceled" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="connected" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="deltaCanceled" nillable="true"
type="xsd:long"/>
<xsd:element minOccurs="0" name="deltaRejected" nillable="true"
type="xsd:long"/>
<xsd:element minOccurs="0" name="inProcess" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="instance" nillable="true" type="xsd:string"/>
<xsd:element minOccurs="0" name="nbAgentAvailable" nillable="true"
type="xsd:long"/>
<xsd:element minOccurs="0" name="nbAgentOffline" nillable="true"
type="xsd:long"/>
<xsd:element minOccurs="0" name="nbAgentOnline" nillable="true"
type="xsd:long"/>
<xsd:element minOccurs="0" name="nbAgentPaused" nillable="true"
type="xsd:long"/>
<xsd:element minOccurs="0" name="presented" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="processed" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="rejected" nillable="true" type="xsd:long"/>
<xsd:element minOccurs="0" name="sAverageWaitCurrent" nillable="true"
type="xsd:string"/>
<xsd:element minOccurs="0" name="sAwaiting" nillable="true"
type="xsd:string"/>
<xsd:element minOccurs="0" name="sMaxWaitCurrent" nillable="true"
type="xsd:string"/>
<xsd:element minOccurs="0" name="status" type="xsd:boolean"/>
<xsd:element minOccurs="0" name="statusColor" nillable="true"
type="xsd:string"/>
<xsd:element minOccurs="0" name="trashed" nillable="true" type="xsd:long"/>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="accesFileCountersResponse">
<xsd:complexType>
<xsd:sequence>
<xsd:element maxOccurs="1" minOccurs="1" name="out" nillable="true"
type="tns:FileCounters"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="StorageException" type="ns1:StorageException"/>
<xsd:element name="DuplicateNameException" type="ns1:DuplicateNameException"/>
<xsd:element name="CapacityExceededException"
type="ns2:CapacityExceededException"/>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://common.ccm.mm.atos.net">
<xsd:complexType name="PermissionDeniedException"/>
<xsd:complexType name="StorageException"/>
<xsd:complexType name="DuplicateNameException"/>
</xsd:schema>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="qualified" elementFormDefault="qualified"
targetNamespace="http://exceptions.ccm.mm.atos.net">
<xsd:complexType name="CapacityExceededException"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="accesFileCountersResponse">
<wsdl:part name="parameters" element="tns:accesFileCountersResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="disconnectResponse">
<wsdl:part name="parameters" element="tns:disconnectResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="CapacityExceededException">
<wsdl:part name="CapacityExceededException"
element="tns:CapacityExceededException">
</wsdl:part>
</wsdl:message>
<wsdl:message name="connectResponse">
<wsdl:part name="parameters" element="tns:connectResponse">
</wsdl:part>
</wsdl:message>
<wsdl:message name="disconnectRequest">
<wsdl:part name="parameters" element="tns:disconnect">
</wsdl:part>
</wsdl:message>
<wsdl:message name="accesFileCountersRequest">
<wsdl:part name="parameters" element="tns:accesFileCounters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="PermissionDeniedException">
<wsdl:part name="PermissionDeniedException"
element="tns:PermissionDeniedException">
</wsdl:part>
</wsdl:message>
<wsdl:message name="DuplicateNameException">
<wsdl:part name="DuplicateNameException" element="tns:DuplicateNameException">
</wsdl:part>
</wsdl:message>
<wsdl:message name="StorageException">
<wsdl:part name="StorageException" element="tns:StorageException">
</wsdl:part>
</wsdl:message>
<wsdl:message name="connectRequest">
<wsdl:part name="parameters" element="tns:connect">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="MyRemoteServicesPortType">
<wsdl:operation name="connect">
<wsdl:input name="connectRequest" message="tns:connectRequest">
</wsdl:input>
<wsdl:output name="connectResponse" message="tns:connectResponse">
</wsdl:output>
<wsdl:fault name="PermissionDeniedException"
message="tns:PermissionDeniedException">
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="disconnect">
<wsdl:input name="disconnectRequest" message="tns:disconnectRequest">
</wsdl:input>
<wsdl:output name="disconnectResponse" message="tns:disconnectResponse">
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="accesFileCounters">
<wsdl:input name="accesFileCountersRequest"
message="tns:accesFileCountersRequest">
</wsdl:input>
<wsdl:output name="accesFileCountersResponse"
message="tns:accesFileCountersResponse">
</wsdl:output>
<wsdl:fault name="StorageException" message="tns:StorageException">
</wsdl:fault>
<wsdl:fault name="DuplicateNameException"
message="tns:DuplicateNameException">
</wsdl:fault>
<wsdl:fault name="PermissionDeniedException"
message="tns:PermissionDeniedException">
</wsdl:fault>
<wsdl:fault name="CapacityExceededException"
message="tns:CapacityExceededException">
</wsdl:fault>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyRemoteServicesHttpBinding"
type="tns:MyRemoteServicesPortType">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="connect">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="connectRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="connectResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="PermissionDeniedException">
<wsdlsoap:fault name="PermissionDeniedException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
<wsdl:operation name="disconnect">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="disconnectRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="disconnectResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="accesFileCounters">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="accesFileCountersRequest">
<wsdlsoap:body use="literal"/>
</wsdl:input>
<wsdl:output name="accesFileCountersResponse">
<wsdlsoap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="StorageException">
<wsdlsoap:fault name="StorageException" use="literal"/>
</wsdl:fault>
<wsdl:fault name="DuplicateNameException">
<wsdlsoap:fault name="DuplicateNameException" use="literal"/>
</wsdl:fault>
<wsdl:fault name="PermissionDeniedException">
<wsdlsoap:fault name="PermissionDeniedException" use="literal"/>
</wsdl:fault>
<wsdl:fault name="CapacityExceededException">
<wsdlsoap:fault name="CapacityExceededException" use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="MyRemoteServices">
<wsdl:port name="MyRemoteServicesHttpPort"
binding="tns:MyRemoteServicesHttpBinding">
<wsdlsoap:address
location="https://myserveradress/webservices/MyRemoteServices"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
---------------------------------------------------------------------------------
Best Regards,
Cheikh Mohamed Lamine SEYDI
+33 (0)6 12 95 83 28
To contribute to the environmental protection, thank you for printing
this e-mail only in case of necessity
________________________________
De : Benson Margulies <[email protected]>
À : [email protected]
Envoyé le : Lun 17 janvier 2011, 22h 01min 12s
Objet : Re: XFire / CXF : Soap reponse return null
We need a lot more information. Are you using Aegis on both ends?
We've probably got incompatibilities there. Your best bet would be to
get a WSDL out of the service and run wsdl2java, and then use JAX-B on
the client.
On Mon, Jan 17, 2011 at 1:38 PM, seydi moha <[email protected]> wrote:
>
> Hello,
>
> I have a problem with my service.
> My server is on xFire and my Client application on cxf. When i try to contact
> my service, my interceptor is ok, but my client object populate null;
> I think that the problem came from xfire Soap response not recognize by Cxf
> client.
> I need a help please to debug this.
>
> Thanks.
>
> Sorry i have a bad english.
>
>
> ---------------------------
> ID: 1
> Address: https://...../MyService
> Encoding: UTF-8
> Content-Type: text/xml
> Headers: {SOAPAction=[""], Accept=[*/*]}
> Payload: 168C3754-800E-FE4F-3160-C8E0B593CE2C
> --------------------------------------
> 17 janv. 2011 19:23:59 org.apache.cxf.interceptor.LoggingInInterceptor logging
> INFO: Inbound Message
> ----------------------------
> ID: 1
> Response-Code: 200
> Encoding: ISO-8859-1
> Content-Type: utf-8
> Headers: {connection=[Keep-Alive], Keep-Alive=[timeout=15, max=100],
Date=[Mon,
> 17 Jan 2011 18:24:22 GMT], transfer-encoding=[chunked], Server=[Apache],
> content-type=[utf-8]}
> Payload: SESS-494EE635-B90B-5589-71B0-6A0E8BCF7C40
> --------------------------------------
> [INFO] webservices.WebServicesUsed sessionID :
>null---------------------------------------------------------------------------------
>-
>
> Best Regards,
>
> To contribute to the environmental protection, thank you for printing
> this e-mail only in case of necessity
> ---------------------------------------------------------------------------------
>-
>
> Best Regards,
>
> To contribute to the environmental protection, thank you for printing
> this e-mail only in case of necessity
>
>
>
>