R
Reg
Hello,
I have a WCF Web Service using wsHttpDualBinding because I need a callback
to Java client.
I read Mr. A.Gupta's blog that if WCF Service uses wsHttpDualBinding for
interop working is not guaranteed.
I also tried to config wsHttpDualBinding in WCF Service Config file as
follows:
<bindings>
<customBinding>
<binding name="Binding1">
<reliableSession />
<compositeDuplex />
<oneWay />
<textMessageEncoding
messageVersion="Soap12WSAddressing10"
writeEncoding="utf-8" />
<httpTransport authenticationScheme="Anonymous"
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
proxyAuthenticationScheme="Anonymous"
realm=""
useDefaultWebProxy="true" />
</binding>
</customBinding>
</bindings>
A C# Client works without problems.
But when using Axis client which is a Java Standalone application following
code:
class ClientUtil
{
public static OMElement getOMElement()
{
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace(
"http://ws.apache.org/axis2/xsd", "ns1");
OMElement method = fac.createOMElement("Hello", omNs);
OMElement value = fac.createOMElement("Hello", omNs);
value.setText("Hello");
method.addChild(value);
return method;
}
}
public class Client
{
private static EndpointReference targetEPR = new EndpointReference
("http://localhost:8000/ServiceMetadata/DuplexService");
public static void main(java.lang.String args[])
{
ServiceClient sender = null;
try {
OMElement payload = ClientUtil.getOMElement();
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setUseSeparateListener(true);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
//Callback to handle the response
Callback callback = new Callback() {
public void onComplete(AsyncResult result)
{
System.out.println(result.getResponseEnvelope());
}
public void onError(Exception e)
{
e.printStackTrace();
}
};
//Non-Blocking Invocation
sender = new ServiceClient();
sender.engageModule(Constants.MODULE_ADDRESSING);
sender.setOptions(options);
sender.sendReceiveNonBlocking(payload, callback);
//Wait till the callback receives the response.
while (!callback.isComplete()) {
Thread.sleep(1000);
}
//Need to close the Client Side Listener.
}
catch (Exception axisFault)
{
axisFault.printStackTrace();
}
}
a Timeout error occurs. I have Addressing library in Axis part so that can't
be a issue.
Axis client hangs in while (!callback.isComplete()) loop and Timeout error
occurs.
Can anyone point what could be the problem? I need a callback feature so,
thats why I'm using wsHttpDualBinding.
Thanks
I have a WCF Web Service using wsHttpDualBinding because I need a callback
to Java client.
I read Mr. A.Gupta's blog that if WCF Service uses wsHttpDualBinding for
interop working is not guaranteed.
I also tried to config wsHttpDualBinding in WCF Service Config file as
follows:
<bindings>
<customBinding>
<binding name="Binding1">
<reliableSession />
<compositeDuplex />
<oneWay />
<textMessageEncoding
messageVersion="Soap12WSAddressing10"
writeEncoding="utf-8" />
<httpTransport authenticationScheme="Anonymous"
bypassProxyOnLocal="false"
hostNameComparisonMode="StrongWildcard"
proxyAuthenticationScheme="Anonymous"
realm=""
useDefaultWebProxy="true" />
</binding>
</customBinding>
</bindings>
A C# Client works without problems.
But when using Axis client which is a Java Standalone application following
code:
class ClientUtil
{
public static OMElement getOMElement()
{
OMFactory fac = OMAbstractFactory.getOMFactory();
OMNamespace omNs = fac.createOMNamespace(
"http://ws.apache.org/axis2/xsd", "ns1");
OMElement method = fac.createOMElement("Hello", omNs);
OMElement value = fac.createOMElement("Hello", omNs);
value.setText("Hello");
method.addChild(value);
return method;
}
}
public class Client
{
private static EndpointReference targetEPR = new EndpointReference
("http://localhost:8000/ServiceMetadata/DuplexService");
public static void main(java.lang.String args[])
{
ServiceClient sender = null;
try {
OMElement payload = ClientUtil.getOMElement();
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
options.setUseSeparateListener(true);
options.setSoapVersionURI(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
//Callback to handle the response
Callback callback = new Callback() {
public void onComplete(AsyncResult result)
{
System.out.println(result.getResponseEnvelope());
}
public void onError(Exception e)
{
e.printStackTrace();
}
};
//Non-Blocking Invocation
sender = new ServiceClient();
sender.engageModule(Constants.MODULE_ADDRESSING);
sender.setOptions(options);
sender.sendReceiveNonBlocking(payload, callback);
//Wait till the callback receives the response.
while (!callback.isComplete()) {
Thread.sleep(1000);
}
//Need to close the Client Side Listener.
}
catch (Exception axisFault)
{
axisFault.printStackTrace();
}
}
a Timeout error occurs. I have Addressing library in Axis part so that can't
be a issue.
Axis client hangs in while (!callback.isComplete()) loop and Timeout error
occurs.
Can anyone point what could be the problem? I need a callback feature so,
thats why I'm using wsHttpDualBinding.
Thanks