Problems with handling incoming SOAP message - java

I am trying to define a SOAP service that consumes OASIS WS-N notification messages.
I do 'WSDL-to-Java' approach but for some reason the incoming message is not being recognized.
Relevant fragments from WSDL:
<wsdl:definitions name="WSNBrokerNotification"
targetNamespace="http://docs.oasis-open.org/wsn/brw-2"
xmlns:tns="http://docs.oasis-open.org/wsn/brw-2"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsntw="http://docs.oasis-open.org/wsn/bw-2"
xmlns:wsnt="http://docs.oasis-open.org/wsn/b-2"
xmlns:wsa="http://www.w3.org/2005/08/addressing"
xmlns:wsrf-rw="http://docs.oasis-open.org/wsrf/rw-2"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsn-br="http://docs.oasis-open.org/wsn/br-2"
xmlns:wstop="http://docs.oasis-open.org/wsn/t-1"
xmlns:wsn-brw="http://docs.oasis-open.org/wsn/brw-2">
...
<wsdl:message name="Notify">
<wsdl:part name="Notify" element="wsnt:Notify"/>
</wsdl:message>
...
<!-- ========= NotificationConsumer PortType Definition =========== -->
<wsdl:portType name="NotificationConsumer">
<wsdl:operation name="Notify">
<wsdl:input message="tns:Notify"/>
</wsdl:operation>
</wsdl:portType>
...
<!-- ========= NotificationConsumer PortType Definition =========== -->
<wsdl:portType name="NotificationConsumer">
<wsdl:operation name="Notify">
<wsdl:input message="tns:Notify"/>
</wsdl:operation>
</wsdl:portType>
...
<wsdl:binding name="NotificationConsumer" type="tns:NotificationConsumer">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="Notify">
<soap:operation soapAction="http://docs.oasis-open.org/wsn/bw-2/NotificationConsumer/Notify"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
</wsdl:operation>
</wsdl:binding>
...
<!-- =============== SERVICE ================= -->
<wsdl:service name="WSNBrokerNotification">
....
<wsdl:port name="NotificationConsumer" binding="tns:NotificationConsumer">
<soap:address location="http://localhost:19001"/>
</wsdl:port>
...
</wsdl:service>
</wsdl:definitions>
When the following SOAP message is arriving:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://docs.oasis-open.org/wsn/bw-2/NotificationConsumer/Notify</a:Action>
<a:To s:mustUnderstand="1">http://jenkins.nu.majiic:50918/spsconsumerTest_f4bcbd26-8e96-45fe-b622-563d0e4a8edf</a:To>
</s:Header>
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Notify xmlns="http://docs.oasis-open.org/wsn/b-2">
<NotificationMessage>
<MyLittleMessage/>
</NotificationMessage>
</Notify>
</s:Body>
</s:Envelope>
my SOAP framework - Apache CXF - reports this:
[qtp558404860-18] WARN org.apache.cxf.phase.PhaseInterceptorChain - Interceptor for {http://consumer.wsn.foo.bar/}WSBrokerNotificationConsumerService has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Message part {http://docs.oasis-open.org/wsn/b-2}Notify was not recognized. (Does it exist in service WSDL?)
at org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.validatePart(DocLiteralInInterceptor.java:252)
at org.apache.cxf.wsdl.interceptors.DocLiteralInInterceptor.handleMessage(DocLiteralInInterceptor.java:191)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:267)
at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:247)
at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:79)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:235)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1300)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:190)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1215)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:500)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:547)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
at java.lang.Thread.run(Thread.java:748)
[qtp558404860-18] INFO org.apache.cxf.services.WSBrokerNotificationConsumerService.WSBrokerNotificationConsumerPort.WSBrokerNotificationConsumer - Outbound Message
I am a bit confused, because I can clearly definition of <Notify> elements with proper namespace, unless I am missing something?...
Any help will be greatly appreciated!

solved; the issue was due to the lack of #WebService annotation on the class that was implementing the web service.

Related

Consuming .net WCF service from Java

I new to Java, and thought it'd be a nice learning exercise to implement a client application on top of a .NET WCF service I'm already familiar with.
I ran wsimport.bat from the latest JAX-WS (https://jax-ws.java.net/) to generate the client proxies, However I'm stuck with the authentication part. The WCF service uses Application level Username/Password to authenticate. I don't know where to supply the credentials.
In C#, for this WCF Service I just need to add a service reference, and do the following:
var client = new ServiceClient();
client.ClientCredentials.UserName.UserName = "username";
client.ClientCredentials.UserName.Password = "password";
client.DoSomething();
From Fiddler, calling client.DoSomething() produces the following request:
<?xml version="1.0"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<s:Header>
<o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" s:mustUnderstand="1">
<u:Timestamp u:Id="_0">
<u:Created>2013-05-20T01:34:28.353Z</u:Created>
<u:Expires>2013-05-20T01:39:28.353Z</u:Expires>
</u:Timestamp>
<o:UsernameToken u:Id="uuid-da5b7b57-dbb4-4c54-b529-f5b41fc728b4-1">
<o:Username>username</o:Username>
<o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">password</o:Password>
</o:UsernameToken>
</o:Security>
</s:Header>
<s:Body>
<DoSomething xmlns="http://tempuri.org/"/>
</s:Body>
</s:Envelope>
Here is the Java I'm currently using:
SomeService service = new SomeService();
ISomeService port = service.getBasicHttpBindingISomeService();
DoSomethingResponse response = port.getDoSomething();
This produces the following request:
<?xml version="1.0"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns6:DoSomething xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns:ns6="http://tempuri.org/" xmlns:ns7="http://schemas.microsoft.com/2003/10/Serialization/"/>
</S:Body>
</S:Envelope>
It's missing the Security node, so I'm not sure how to set that up on the Java side. What am I missing?
I'm not 100% bound to using JAX-WS, if there is a better alternative out there for my needs. However, the WCF service can not be modified to reconfigured, as it's out of my reach.
WSDL:
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" name="SomeService" targetNamespace="http://tempuri.org/">
<wsp:Policy wsu:Id="BasicHttpBinding_ISomeService_policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken RequireClientCertificate="false"/>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic256/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Lax/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
</wsp:Policy>
</sp:TransportBinding>
<sp:SignedSupportingTokens xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:UsernameToken sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient">
<wsp:Policy>
<sp:WssUsernameToken10/>
</wsp:Policy>
</sp:UsernameToken>
</wsp:Policy>
</sp:SignedSupportingTokens>
<sp:Wss10 xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy/>
</sp:Wss10>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import schemaLocation="https://someservice.com/service.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
<xsd:import schemaLocation="https://someservice.com/service.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
<xsd:import schemaLocation="https://someservice.com/service.svc?xsd=xsd6" namespace="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="ISomeService_DoSomething_OutputMessage">
<wsdl:part name="parameters" element="tns:DoSomethingResponse"/>
</wsdl:message>
<wsdl:portType name="ISomeService">
<wsdl:operation name="DoSomething">
<wsdl:input wsaw:Action="http://tempuri.org/ISomeService/DoSomething" message="tns:ISomeService_DoSomething_InputMessage"/>
<wsdl:output wsaw:Action="http://tempuri.org/ISomeService/DoSomethingResponse" message="tns:ISomeService_DoSomething_OutputMessage"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_ISomeService" type="tns:ISomeService">
<wsp:PolicyReference URI="#BasicHttpBinding_ISomeService_policy"/>
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="DoSomething">
<soap:operation soapAction="http://tempuri.org/ISomeService/DoSomething" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SomeService">
<wsdl:port name="BasicHttpBinding_ISomeService" binding="tns:BasicHttpBinding_ISomeService">
<soap:address location="https://someservice.com/service.svc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I'm using the latest JDK on Windows 8 x64
You need to create a custom CallbackHandler from your Java client. I am not an expert in Java but I know that some of my clients use Metro libraries to communicate with my WCF web services.
Try searching for creating a CallbackHandler with/without Metro library.
You can download Metro library from here.
An example of what I am suggesting.

<soap:address> location attribute when using Netbeans New -> Webservice from WSDL using XMLSpy

I'm trying to create a webservice using the New -> Web Service from WSDL in Netbeans 7.1.2.
I went ahead and created a WSDL using XML spy. Here is the basic WSDL that I've created:
<wsdl:definitions xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://www.w3.org/ns/ws-policy"
xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://planningservice.ohs.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns="http://docs.oasis-open.org/wsn/t-1" xmlns:ns1="http://www.isotc211.org/2005/gco" xmlns:ns2="http://www.isotc211.org/2005/gmd" xmlns:ns3="http://www.isotc211.org/2005/gsr" xmlns:ns4="http://www.isotc211.org/2005/gss" xmlns:ns5="http://www.isotc211.org/2005/gts" xmlns:ns6="http://www.opengis.net/gml/3.2" xmlns:ns7="http://www.opengis.net/ows/1.1" xmlns:ns8="http://www.opengis.net/sps/2.0" xmlns:ns9="http://www.opengis.net/swe/2.0" xmlns:ns10="http://www.opengis.net/swes/2.0" xmlns:ns11="http://www.w3.org/2005/08/addressing" name="PlanningService" targetNamespace="http://planningservice.ohs.com/">
<wsdl:import namespace="http://www.opengis.net/sps/2.0" location="http://schemas.opengis.net/sps/2.0/spsGetFeasibility.xsd"/>
<wsdl:types>
<xsd:schema>
<xsd:import namespace="http://ps.ca"/>
</xsd:schema>
</wsdl:types>
<wsdl:message name="GetFeasibility">
<wsdl:part name="parameters" type="ns8:GetFeasibilityType"/>
</wsdl:message>
<wsdl:message name="GetFeasibilityResponse">
<wsdl:part name="parameters" type="ns8:GetFeasibilityResponseType"/>
</wsdl:message>
<wsdl:portType name="PlanningService">
<wsdl:operation name="GetFeasibility">
<wsdl:input message="tns:GetFeasibility" wsam:Action="http://planningservice.ohs.com/PlanningService/getFeasibility"/>
<wsdl:output message="tns:GetFeasibilityResponse" wsam:Action="http://planningservice.ohs.com/PlanningService/getFeasibilityResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="PlanningSerivcePortBinding" type="tns:PlanningService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="GetFeasibility">
<soap:operation soapAction="' '"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="PlanningSerivce">
<wsdl:port name="PlanningService" binding="tns:PlanningSerivcePortBinding">
<soap:address location="http://localhost:8080/PlanningService/"/>
</wsdl:port>
</wsdl:service>
When I try using the above I the 'New Web Service From WSDL' wizard says "There is no service in specified WSDL file."
If I don't specify the location attribute, like so:
<wsdl:service name="PlanningSerivce">
<wsdl:port name="PlanningService" binding="tns:PlanningSerivcePortBinding">
<soap:address/>
</wsdl:port>
</wsdl:service>
I don't have that notification but during the creation of the Web Service I get an error that says the attribute is missing.
So my question is what do I put in the location attribute to get Netbeans to recognize that there is a service defined, given that it isn't deployed anywhere!
Thanks all!
~D
The WSDL document as provided is not entirely valid.
The first issue is the declaration of the document style but the message declaration in the rpc style. Rpc uses message parts defined in terms of 'type's. Document uses message parts defined in terms of 'element's. I looked over the XSD imported into the WSDL and found the 'GetFeasibility' and 'GetFeasibilityResponse' elements defined there. So, changing the wsdl:message nodes to
<wsdl:message name="GetFeasibility">
<wsdl:part name="parameters" element="ns8:GetFeasibility"/>
</wsdl:message>
<wsdl:message name="GetFeasibilityResponse">
<wsdl:part name="parameters" element="ns8:GetFeasibilityResponse"/>
</wsdl:message>
helps by making the message definitions consistent with the document style service.
There is a nice writeup at http://www.ibm.com/developerworks/webservices/library/ws-whichwsdl/ about wsdl construction w.r.t. declared styles.
The next issue is the schema import. There are special restrictions around the wsdl:import statement. In general, the proper place to pull in schemas is the wsdl:types section. If you use something like
<wsdl:types>
<xsd:schema>
<xsd:import namespace="http://www.opengis.net/sps/2.0"
schemaLocation="http://schemas.opengis.net/sps/2.0/spsGetFeasibility.xsd"/>
<xsd:import namespace="http://ps.ca"/>
</xsd:schema>
</wsdl:types>
(not sure of the value of the ps.ca import), the relevant types are available for the wsdl import machinery. A writeup of wsdl importing is at http://scn.sap.com/people/kevin.liu/blog/2004/06/28/a-note-on-wsdl-and-xsd-imports
Once these modifications were made, wsimport still saw an error in the form of a name collision in the supporting schemas at opengis.net, but hopefully this gives you enough to move our project along a bit and you can focus on the name collision rather than fighting the wsdl construction.

Specified throwing AxisFault in WSDL file

I generate my web service from WSDL file. But I need t o define in this file that my methods in SkeletonInterface thow Axis Fault Exception.
Smth like:
void method() throws AxisFault{....}
In which way I can do this (in WSDL).
Thanks.
In short, it's bad practice to reuse AxisFault for your own application faults. When I see AxisFault, it signals that something internal to the Axis autogen code failed. This could include your exception wrapped inside of it.
First, I want to address your pseudcode.
void method() throws AxisFault{....}
This pseudocode indicates that you want a method with no input, no output, but still have an exception. If I assume this, then that design is not recommended (I'm not even sure if it is possible). If you want something to trigger something to happen with no output, an empty output message is preferable to an exception. Exceptions should only be used when something uncommon happens.
If you meant the above code as an abstract example and you do have input/output, then the correct approach would be to make up your own fault. Using your own fault allows you to control behavior and more accurately describe what is failing. You may also need several faults in the future so using AxisFault is not beneficial in that case.
<wsdl:definitions ...>
...
<wsdl:message name="MyFault">
<wsdl:part name="parameters" element="def:MyFault">
</wsdl:part>
</wsdl:message>
<wsdl:portType name="MyPortType">
<wsdl:operation name="doStuff">
<wsdl:input message="tns:MyRequest">
</wsdl:input>
<wsdl:output message="tns:MyResponse">
</wsdl:output>
<wsdl:fault name="MyFault" message="tns:MyFault">
</wsdl:fault>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="MyBinding" type="tns:MyPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="doStuff">
<soap:operation soapAction="namespace/operationName"/>
<wsdl:input name="MyRequest">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="MyResponse">
<soap:body use="literal"/>
</wsdl:output>
<wsdl:fault name="MyFault">
<soap:body use="literal"/>
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
...
</wsdl:definitions>
That said, AxisFault does happen for web service operation calls. For your client stub code, it should throw a RemoteException. If you take a look at your autogen Stub code, you should see that does in fact throw an AxisFault which extends RemoteException.
using the faults
<definitions ...>
<message name="empty"/>
<message name="InsufficientFundsFault">
<part name="balance" type="xsd:int"/>
</message>
<portType name="Bank">
<operation name="throwException">
<input message="tns:empty"/>
<output message="tns:empty"/>
<fault name="fault" message="tns:InsufficientFundFault"/>
</operation>
</portType>
...
</definitions>

Calling a Java web service created using Axis from PHP code

Im trying to call a Java web service created using Axis from PHP code.The webservice is hosted on my LAN. I am able to call the web service successfully using SoapUI. I have the PHP Soap Extension installed.
However,im not sure whether my PHP code is correct. Below is my PHP code.
<?php
$client = new SoapClient('http://machinename/axis/services/Compiere?wsdl');
$params = array('in0'=> '124','in1'=>'1');
$result = $client->__SoapCall('createOrder',array($params));
print $result->createOrderReturn;
?>
The WSDL is as follows :
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://compservice.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://compservice.com" xmlns:intf="http://compservice.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)-->
<wsdl:message name="createOrderRequest">
<wsdl:part name="in0" type="xsd:int"/>
<wsdl:part name="in1" type="xsd:int"/>
</wsdl:message>
<wsdl:message name="createOrderResponse">
<wsdl:part name="createOrderReturn" type="xsd:string"/>
</wsdl:message>
<wsdl:portType name="OrderServiceInt">
<wsdl:operation name="createOrder" parameterOrder="in0 in1">
<wsdl:input message="impl:createOrderRequest" name="createOrderRequest"/>
<wsdl:output message="impl:createOrderResponse" name="createOrderResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="CompiereSoapBinding" type="impl:OrderServiceInt">
<wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="createOrder">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="createOrderRequest">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://compservice.com" use="encoded"/>
</wsdl:input>
<wsdl:output name="createOrderResponse">
<wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://compservice.com" use="encoded"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="OrderServiceIntService">
<wsdl:port binding="impl:CompiereSoapBinding" name="Compiere">
<wsdlsoap:address location="http://nuca232/axis/services/Compiere"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Is my PHP code correct ?
Please help.
Thank You.
Why don't you try the direct mode?
<?php
$client = new SoapClient('http://machinename/axis/services/Compiere?wsdl');
$params = array('in0'=> '124','in1'=>'1');
$result = $client->createOrder( $parms );
print_r($result);
Instead of using $client->__SoapCall('createOrder',array($params));
As the manual says: "Usually, in WSDL mode, SOAP functions can be called as methods of the SoapClient object"

wsdl2java Error: Emitter failure. Invalid endpoint address in port

I am trying to run the wsdl2java command on a WSDL file that was given to me from another group in my company. I know wsdl2java works because I can run the examples but when I try it on the wsdl given to me it fails. The one big difference is that the WSDL given to me uses SSL.
I’m using Java 1.4 (checked it a few time) and made sure all the correct jars are in my class path, jsse.jar is there.
COMMAND: java org.apache.axis.wsdl.WSDL2Java --server-side GenericWebService.wsdl
ERROR:
log4j:WARN No appenders could be found for logger (org.apache.axis.i18n.ProjectResourceBundle).
log4j:WARN Please initialize the log4j system properly.
**java.io.IOException: Emitter failure. Invalid endpoint address in port AC_x0020_Generic_x0020_Web_0020_ServiceSoap in service AC_x0020_Generic_x0020_Web_x0020_ServiceLocator: **
at org.apache.axis.wsdl.toJava.JavaServiceImplWriter.writeFileBody(JavaServiceImplWriter.ja
a:242)
at org.apache.axis.wsdl.toJava.JavaWriter.generate(JavaWriter.java:127)
at org.apache.axis.wsdl.toJava.JavaServiceWriter.generate(JavaServiceWriter.java:112)
at org.apache.axis.wsdl.toJava.JavaGeneratorFactory$Writers.generate(JavaGeneratorFactory.j
va:421)
at org.apache.axis.wsdl.gen.Parser.generate(Parser.java:476)
at org.apache.axis.wsdl.gen.Parser.access$000(Parser.java:45)
at org.apache.axis.wsdl.gen.Parser$WSDLRunnable.run(Parser.java:362)
at java.lang.Thread.run(Thread.java:534)
asdf
<wsdl:portType name="AC_x0020_Generic_x0020_Web_x0020_ServiceSoap">
<wsdl:operation name="Provision">
<wsdl:input message="tns:ProvisionSoapIn" />
<wsdl:output message="tns:ProvisionSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AC_x0020_Generic_x0020_Web_x0020_ServiceSoap" type="tns:AC_x0020_Generic_x0020_Web_x0020_ServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="Provision">
<soap:operation soapAction="http://xmlns.fmr.com/systems/dev/aar/2008/05/GenericWebService/Provision" style="document" />
<wsdl:input>
<soap:body use="literal" />
<soap:header message="tns:ProvisionServiceProcessingDirectives" part="ServiceProcessingDirectives" use="literal" />
<soap:header message="tns:ProvisionServiceCallContext" part="ServiceCallContext" use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="AC_x0020_Generic_x0020_Web_x0020_Service">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Generic web service definition for provisioning requests callable by AccessCENTRAL</wsdl:documentation>
<wsdl:port name="AC_x0020_Generic_x0020_Web_x0020_ServiceSoap" binding="tns:AC_x0020_Generic_x0020_Web_x0020_ServiceSoap">
<soap:address location="" />
</wsdl:port>
</wsdl:service>
UPDATED SOLUTION:
The problem was that the parser needed a value in the <soap:address location="" /> for it to complete. I added the URL of my service and it worked.
New Lines looked like:
<soap:address location="" http://localhost:8080/axis/services/AC_x0020_Generic_x0020_Web_x0020_Service" />
The location specified by the soap:address is blank. It should be the URI of the SOAP service. See soap:address.
Looking at soapAction, http://xmlns.fmr.com/systems/dev/aar/2008/05/GenericWebService might be the correct value for location.

Categories

Resources