- 5.3K All Categories
- 15 Introduce Yourself!
- 457 Community Feedback - NEW! (No Product Questions)
- 108 General Community Platform Concerns/Kudos/Feedback
- 83 Community Platform Bug Reports
- 87 How Do I Use the Community?
- 65 Where is the...? (Community Platform Locations)
- 18 Ideas and Suggestions for the Community Platform
- 4.8K Certification Community
- 4.7K Certification Community Discussions
- 22 Oracle Certified Master Profiles
- 31 Oracle Database 12c Administrator Certified Master Profiles
- 83 Visual Builder Cloud Service
How to use WCF Service with wsHttpBinding Axis2 in Java Client
I have to use a WCF service in a Java client. I have generated proxy code using Axis2 library. I have successfully configured proxy classes but getting issue when calling WCF service method.
Following is the code in my java client.
ServiceXMLStub stub = new ServiceXMLStub("https://qa1-myservice.com/integration/ServiceXML.svc"); GetMetadata meta = new GetMetadata(); meta.setStateCode("WA"); meta.setUserName("tpstester1"); stub._getServiceClient().getOptions().setProperty(Constants.Configuration.MESSAGE_TYPE,HTTPConstants.MEDIA_TYPE_APPLICATION_ECHO_XML); stub._getServiceClient().getOptions().setProperty(Constants.Configuration.DISABLE_SOAP_ACTION,Boolean.TRUE); stub._getServiceClient().engageModule("addressing"); stub._getServiceClient().getOptions().setUserName("myuser"); stub._getServiceClient().getOptions().setPassword("[email protected]"); GetMetadataResponse response = stub.getMetadata(meta);
Following is the issue I am getting when calling this service from this client.
org.apache.axis2.AxisFault: The message could not be processed. This is most likely because the action 'http://Integration.ContractsXML/IServiceXML/GetMetadata' is incorrect or because the message contains an invalid or expired security context token or because there is a mismatch between bindings. The security context token would be invalid if the service aborted the channel due to inactivity. To prevent the service from aborting idle sessions prematurely increase the Receive timeout on the service endpoint's binding.
I tested this code in .Net client and it works fine there
ServiceReference1.ServiceXMLClient serviceClient = new ServiceReference1.ServiceXMLClient(); serviceClient.ClientCredentials.UserName.UserName = "myuser"; serviceClient.ClientCredentials.UserName.Password = "[email protected]"; var result = serviceClient.GetMetadata("tpstester1", "SA");
What am I missing here ?
I read somewhere that NetBeans with Metro library can be helpful for interop between wcf & java client but I don't know about it as I have been using Eclipse.