I tried to pull JAX-WS SOAP 1.2 WSDL service using iOS. I used WSDL2ObjC converter to convert the url (WSDL file given below) into class files.
NSDate+ISO8601Parsing.h
NSDate+ISO8601Parsing.m
NSDate+ISO8601Unparsing.h
NSDate+ISO8601Unparsing.m
SimpleWebServiceServiceSvc.h
SimpleWebServiceServiceSvc.m
USAdditions.h
USAdditions.m
USGlobals.h
USGlobals.m
xs.h
xs.m
<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:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://sample.jaxws.ws.blog.accrd.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://sample.jaxws.ws.blog.accrd.com/" name="SimpleWebServiceService">
<types>
<xsd:schema>
<xsd:import namespace="http://sample.jaxws.ws.blog.accrd.com/" schemaLocation="http://192.168.1.45:8080/SimpleWebService/SimpleWebService?xsd=1"/>
</xsd:schema>
</types>
<message name="sayHello">
<part name="parameters" element="tns:sayHello"/>
</message>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse"/>
</message>
<portType name="SimpleWebService">
<operation name="sayHello">
<input wsam:Action="http://sample.jaxws.ws.blog.accrd.com/SimpleWebService/sayHelloRequest" message="tns:sayHello"/>
<output wsam:Action="http://sample.jaxws.ws.blog.accrd.com/SimpleWebService/sayHelloResponse" message="tns:sayHelloResponse"/>
</operation>
</portType>
<binding name="SimpleWebServicePortBinding" type="tns:SimpleWebService">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="sayHello">
<soap12:operation soapAction=""/>
<input>
<soap12:body use="literal"/>
</input>
<output>
<soap12:body use="literal"/>
</output>
</operation>
</binding>
<service name="SimpleWebServiceService">
<port name="SimpleWebServicePort" binding="tns:SimpleWebServicePortBinding">
<soap12:address location="http://192.168.1.45:8080/SimpleWebService/SimpleWebService"/>
</port>
</service>
</definitions>
I got above files and implemented into my project and tried to pull the service using below codings.
SimpleWebServicePortBinding *binding = [SimpleWebServiceServiceSvc SimpleWebServicePortBinding];
binding.logXMLInOut = YES;
SimpleWebServicePortBindingResponse *response;
SimpleWebServiceServiceSvc_sayHello *sayHello = [[SimpleWebServiceServiceSvc_sayHello alloc] init];
sayHello.arg0 = [[SimpleWebServiceServiceSvc_customer alloc] init];
sayHello.arg0.firstName = #"FirstName";
sayHello.arg0.lastName = #"LastName";
response = [binding sayHelloUsingParameters:sayHello];
dispatch_async(dispatch_get_main_queue(), ^{
[self processResponse:response];
});
But I'm always getting below response. Can any one help me how to solve this or any other way to use JAX-WS service in iOS.
2013-07-25 12:37:59.205 LocalWSDL[1356:11303] OutputHeaders:
{
"Content-Length" = 729;
"Content-Type" = "application/soap+xml; charset=utf-8";
Host = "192.168.1.45";
SOAPAction = "";
"User-Agent" = wsdl2objc;
}
2013-07-25 12:37:59.225 LocalWSDL[1356:11303] OutputBody:
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:SimpleWebServiceServiceSvc="http://sample.jaxws.ws.blog.accrd.com/" xsl:version="1.0">
<soap:Body>
<SimpleWebServiceServiceSvc:sayHello>
<SimpleWebServiceServiceSvc:arg0>
<SimpleWebServiceServiceSvc:firstName>FirstName</SimpleWebServiceServiceSvc:firstName>
<SimpleWebServiceServiceSvc:lastName>LastName</SimpleWebServiceServiceSvc:lastName>
</SimpleWebServiceServiceSvc:arg0>
</SimpleWebServiceServiceSvc:sayHello>
</soap:Body>
</soap:Envelope>
2013-07-25 12:37:59.239 LocalWSDL[1356:11303] ResponseStatus: 500
2013-07-25 12:37:59.239 LocalWSDL[1356:11303] ResponseHeaders:
{
"Content-Type" = "application/soap+xml; charset=utf-8";
Date = "Thu, 25 Jul 2013 07:08:06 GMT";
"Transfer-Encoding" = Identity;
}
2013-07-25 12:37:59.240 LocalWSDL[1356:11303] ResponseBody:
<?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope"><S:Body><S:Fault xmlns:ns4="http://schemas.xmlsoap.org/soap/envelope/"><S:Code><S:Value>S:Receiver</S:Value></S:Code><S:Reason><S:Text xml:lang="en">java.lang.NullPointerException</S:Text></S:Reason></S:Fault></S:Body></S:Envelope>
I used http://wsclient.neurospeech.com/download/ to covert my WSDL link into classes.
NSWSDL.h
NSWSDL.m
SimpleWebService.h
SimpleWebService.m
Then used only four line codings to finish my Task. Thanks for wsclient :).
This may useful for some one.
SimpleWebServiceService *objService = [SimpleWebServiceService service];
WEcustomer *argument = [[WEcustomer alloc] init];
argument.firstName = #"Ganesh";
argument.lastName = #"Ananthan";
NSError *error;
NSString *myresult = [objService sayHello:argument error:&error];
NSLog(#" My Result %#",myresult);
Related
I have created SOAP service in NetBeans 13 that starts on GlassFish server with minor warnings:
Tue Jan 31 16:54:05 EET 2023 : Security manager installed using the Basic server security policy.
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.apache.derby.drda.NetworkServerControl (file:/C:/java_test/AppServer/Glassfish/javadb/lib/derbynet.jar)
WARNING: Please consider reporting this to the maintainers of org.apache.derby.drda.NetworkServerControl
WARNING: System::setSecurityManager will be removed in a future release
Tue Jan 31 16:54:05 EET 2023 : Apache Derby Network Server - 10.15.2.0 - (1873585) started and ready to accept connections on port 1527
Service code:
package javaeetutorial.helloservice;
import javax.jws.WebService;
import javax.jws.WebMethod;
#WebService
public class Hello {
private final String message = "Hello, ";
public Hello() {
}
#WebMethod
public String sayHello(String name) {
return message + name + ".";
}
#WebMethod
public String sayHello2(String name) {
return message + name + ".";
}
}
I found WSDL file of this project in location \helloservice-war\target\generated-sources\wsdl\HelloService.wsdl
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI (https://github.com/eclipse-ee4j/metro-jax-ws). RI's version is JAX-WS RI 2.3.3 git-revision#b4c5bb6. -->
<definitions targetNamespace="http://helloservice.javaeetutorial/" name="HelloService" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:tns="http://helloservice.javaeetutorial/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata">
<types>
<xsd:schema>
<xsd:import namespace="http://helloservice.javaeetutorial/" schemaLocation="HelloService_schema1.xsd"/>
</xsd:schema>
</types>
<message name="sayHello2">
<part name="parameters" element="tns:sayHello2"/>
</message>
<message name="sayHello2Response">
<part name="parameters" element="tns:sayHello2Response"/>
</message>
<message name="sayHello">
<part name="parameters" element="tns:sayHello"/>
</message>
<message name="sayHelloResponse">
<part name="parameters" element="tns:sayHelloResponse"/>
</message>
<portType name="Hello">
<operation name="sayHello2">
<input wsam:Action="http://helloservice.javaeetutorial/Hello/sayHello2Request" message="tns:sayHello2"/>
<output wsam:Action="http://helloservice.javaeetutorial/Hello/sayHello2Response" message="tns:sayHello2Response"/>
</operation>
<operation name="sayHello">
<input wsam:Action="http://helloservice.javaeetutorial/Hello/sayHelloRequest" message="tns:sayHello"/>
<output wsam:Action="http://helloservice.javaeetutorial/Hello/sayHelloResponse" message="tns:sayHelloResponse"/>
</operation>
</portType>
<binding name="HelloPortBinding" type="tns:Hello">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name="sayHello2">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="sayHello">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="HelloService">
<port name="HelloPort" binding="tns:HelloPortBinding">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>
When I run project from IDE it opens browser on adrees http://localhost:8080/helloservice-war/HelloService?Tester . Browser window shows error 404-Not found
I feed WSDL to SOAPUI client and have changed service path REPLACE_WITH_ACTUAL_URL to http://localhost:8080/helloservice-war/HelloService . I called function sayHello, but got 404 error.
Where is my service located and how to call it's functions?
GlassFish console:
I have created WSDL file connect the file with PERL soap method. After the exection i get the below error message
"not well-formed (invalid token) at line 1, column 1, byte 1 at /usr/lib/x86_64-linux-gnu/perl5/5.26/XML/Parser.pm line 187." .
Please let me know have to fix the issue. Review below source code.
soap-client.pl
#!/usr/bin/perl -w
#use SOAP::Lite +trace => ‘debug’;
use SOAP::Lite;
my $client = SOAP::Lite
->service('http://localhost/soap/perl/marketplace.wsdl');
my $result = $client->login( 'test_user', 'test_password' );
#~ my $result = $client->sayHello('');
print $result;
soap-server.pl
#!/usr/bin/perl
function login( $login, $password )
{
return $login;
}
function doFilter( $params )
{
return "some string";
}
marketplace.wsdl
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="Marketplace"
targetNamespace="urn:Marketplace"
xmlns:tns="urn:Marketplace"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<message name="LoginRequest">
<part name="login" type="xsd:string"/>
<part name="password" type="xsd:string"/>
</message>
<message name="LoginResponse">
<part name="result" type="xsd:string"/>
</message>
<portType name="LoginPort">
<operation name="login">
<input message="tns:LoginRequest"/>
<output message="tns:LoginResponse"/>
</operation>
</portType>
<binding name="LoginBinding" type="tns:LoginPort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="login">
<soap:operation soapAction="urn:LoginAction"/>
<input>
<soap:body use="encoded" namespace="urn:Marketplace" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:Marketplace" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="WSDLService">
<port name="LoginPort" binding="tns:LoginBinding">
<soap:address location="http://localhost/soap/perl/soap-server.pl"/>
</port>
</service>
</definitions>
finally run the soap-client.pl file return below error message.
"not well-formed (invalid token) at line 1, column 1, byte 1 at /usr/lib/x86_64-linux-gnu/perl5/5.26/XML/Parser.pm line 187." .
Uncomment #use SOAP::Lite +trace => ‘debug’; line and see the resulting error.
I have a SOAP::Lite client using the service method to grab a wsdl. This needs to call a webservice with a single operation and method with no parameters. It's resulting in a nested method call that the provider tells me is wrong. And I'm not very knowledgeable about SOAP::Lite or webservices. Advice appreciated!
my $lookup = SOAP::Lite->service('http://hostname.com/path/SpringVerifierWebServicePort?wsdl')
-> proxy("$theURL") ;
$response = $lookup->verifySpring('');
And that is generating this stub on the call.
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://webservice.springverifier.toolslang.fedins.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soap:Body>
<tns:verifySpring>
<verifySpring xsi:nil="true" xsi:type="tns:verifySpring" />
</tns:verifySpring> </soap:Body></soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x167bee8)
SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 500 Internal Server Error
The provider of that webservice tells me the 500 error is due to the nested verifySpring on the call. Do I need to call this differently than I am, or is the WSDL invalid and screwing up SOAP::Lite? I don't know enough about SOAP and webservices to say if the problem is the WSDL, or if I need to call this differently in SOAP::LITE. Could anyone give me some direction please?
The provider WSDL is this:
<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://webservice.springverifier.toolslang.fedins.com" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" name="SpringVerifierWebServiceService" targetNamespace="http://webservice.springverifier.toolslang.fedins.com">
<wsdl:types>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://webservice.springverifier.toolslang.fedins.com" targetNamespace="http://webservice.springverifier.toolslang.fedins.com" version="1.0">
<xs:element name="verifySpring" type="tns:verifySpring" />
<xs:element name="verifySpringResponse" type="tns:verifySpringResponse" />
<xs:complexType name="verifySpring">
<xs:sequence />
</xs:complexType>
<xs:complexType name="verifySpringResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="tns:environmentInfo" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="environmentInfo">
<xs:sequence>
<xs:element minOccurs="0" name="dbRegion" type="xs:string" />
<xs:element minOccurs="0" name="jndi" type="xs:string" />
<xs:element minOccurs="0" name="springProfile" type="xs:string" />
<xs:element minOccurs="0" name="systemDate" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:schema>
</wsdl:types>
<wsdl:message name="verifySpringResponse">
<wsdl:part element="tns:verifySpringResponse" name="parameters" />
</wsdl:message>
<wsdl:message name="verifySpring">
<wsdl:part element="tns:verifySpring" name="parameters" />
</wsdl:message>
<wsdl:portType name="SpringVerifierWebService">
<wsdl:operation name="verifySpring">
<wsdl:input message="tns:verifySpring" name="verifySpring" />
<wsdl:output message="tns:verifySpringResponse" name="verifySpringResponse" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="SpringVerifierWebServiceServiceSoapBinding" type="tns:SpringVerifierWebService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="verifySpring">
<soap:operation soapAction="" style="document" />
<wsdl:input name="verifySpring">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="verifySpringResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="SpringVerifierWebServiceService">
<wsdl:port binding="tns:SpringVerifierWebServiceServiceSoapBinding" name="SpringVerifierWebServicePort">
<soap:address location="http://dev1.spring.service.fedins.com/fedservice/toolslang/springverifier/webservice/services/SpringVerifierWebServicePort" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
'' is an actual value (empty string), use verifySpring(); and not verifySpring('');
Example
#!/usr/bin/perl --
use strict;
use warnings;
use SOAP::Lite;
my $soap = SOAP::Lite
-> uri('http://127.0.0.1/MyModule')
-> proxy('http://127.0.0.1:1203')
;;;;;;;;;
$soap->readable(1);
$soap->transport->add_handler("request_send", sub { print $_[0]->as_string,"\n"; return } );
eval { $soap->verifySpring(''); 1 } or print "$#\n";
eval { $soap->verifySpring(); 1 } or print "$#\n";
__END__
POST http://127.0.0.1:1203 HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
User-Agent: SOAP::Lite/Perl/1.11
Content-Length: 522
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://127.0.0.1/MyModule#verifySpring"
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<verifySpring xmlns="http://127.0.0.1/MyModule">
<c-gensym3 xsi:type="xsd:string" />
</verifySpring>
</soap:Body>
</soap:Envelope>
500 Can't connect to 127.0.0.1:1203 at - line 11.
POST http://127.0.0.1:1203 HTTP/1.1
Accept: text/xml
Accept: multipart/*
Accept: application/soap
User-Agent: SOAP::Lite/Perl/1.11
Content-Length: 475
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://127.0.0.1/MyModule#verifySpring"
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<verifySpring xmlns="http://127.0.0.1/MyModule" xsi:nil="true" />
</soap:Body>
</soap:Envelope>
500 Can't connect to 127.0.0.1:1203 at - line 12.
I am trying to configure an existing SOAP web service in Mule using Mule Flows. I have an HTTP endpoint with request/response and a SOAP component, say Service A.
I want to configure this setup for a simple flow to work. I have set my HTTP endpoint and the SOAP service. The flow file is shown below.
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:http="http://www.mulesoft.org/schema/mule/http" xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="CE-3.2.1" xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd ">
<flow name="demoflowFlow1" doc:name="demoflowFlow1">
<http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" doc:name="HTTP"/>
<cxf:jaxws-service port="8082" serviceClass="com.myapp.serviceA.ServiceAImplService" doc:name="SOAP"/>
</flow>
</mule>
This is not working. My service is a simple one and it takes in a string and returns a string.
#WebService(targetNamespace = "http://service.demo.myapp.com/", endpointInterface = "com.myapp.demo.service.IServiceA", portName = "ServiceAImplPort", serviceName = "ServiceAImplService")
public class ServiceAImpl implements IServiceA {
public String hello(String user) {
return "at service A: " + user;
}
}
I am invoking my flow with the HTTP inbound URL http://localhost:8081/{I am not sure what goes here!} and getting:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>No such operation: (HTTP GET PATH_INFO: /)</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
The Mule flow is running as an application in Mule Studio, and the service is running as a SOAP web service from Springsource toolsuite.
What am I doing wrong?
Original WSDL at http://localhost:8080/ServiceA/services/ServiceAImplPort?wsdl
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.demo.myapp.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="ServiceAImplService" targetNamespace="http://service.demo.myapp.com/">
<wsdl:types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://service.demo.myapp.com/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<import namespace="http://service.demo.myapp.com/" schemaLocation="http://localhost:8080/ServiceA/services/ServiceAImplPort?xsd=serviceaimpl_schema1.xsd"/>
</schema>
</wsdl:types>
<wsdl:message name="helloResponse">
<wsdl:part element="tns:helloResponse" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:message name="hello">
<wsdl:part element="tns:hello" name="parameters"></wsdl:part>
</wsdl:message>
<wsdl:portType name="IServiceA">
<wsdl:operation name="hello">
<wsdl:input message="tns:hello" name="hello"></wsdl:input>
<wsdl:output message="tns:helloResponse" name="helloResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServiceAImplServiceSoapBinding" type="tns:IServiceA">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="hello">
<soap:operation soapAction="urn:Hello" style="document"/>
<wsdl:input name="hello">
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output name="helloResponse">
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ServiceAImplService">
<wsdl:port binding="tns:ServiceAImplServiceSoapBinding" name="ServiceAImplPort">
<soap:address location="http://localhost:8080/ServiceA/services/ServiceAImplPort"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
FYI, I can run the web service from SpringSource toolsuite without issues. Now, how do I invoke the web service from my HTTP inbound URL with a GET request?
[I presume simple web services like these take GET requests.]
I think you forgot the #WebMethod annotation at your method. This is basically what your error says: No operation.
Here is a very good example how you can do it.
#WebService(targetNamespace = "http://service.demo.myapp.com/", endpointInterface = "com.myapp.demo.service.IServiceA", portName = "ServiceAImplPort", serviceName = "ServiceAImplService")
public class ServiceAImpl implements IServiceA {
#WebMethod
#WebResult(name="result")
public String hello(#WebParam(name="user")String user) {
return "at service A: " + user;
}
}
It's very easy ... I guess com.myapp.serviceA.ServiceAImplService is your Service Implementation class and IServiceA.java is your Service class ... why don't you try this :-
There is something wrong in your wsdl.... Why < wsdl:service name="ServiceAImplService" > is ServiceAImplService ... instead it should be IServiceA .... ServiceAImplService is the web service implementation class I guess and should be kept in in mule flow
I want to make a SOAP call to a local web service. The web service is defined via a WSDL file (see below). I want to use Perl and SOAP::Lite. I tried this:
use strict ;
use warnings ;
use SOAP::Lite ;
my $endpoint = qq{http://example.com:2222/orawsv/PS_API/ACCOUNT_WS} ;
my $tns = 'http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS' ;
my $method_urn = $tns ;
my $soapaction = $tns ;
my $method = 'GET_BY_ACCOUNT_NUMBER' ;
my $sObj = SOAP::Lite->new(uri => $soapaction, proxy => $endpoint) ;
my $response = $sObj->call(SOAP::Data->name($method)->attr({ 'xmlns' => $method_urn})
=> SOAP::Data->name('ACCOUNT_NUMBER-VARCHAR2-IN' => '274724')) ;
print $response->faultstring() . "\n";
However, this results in an XML parsing failed error message. What would be the correct SOAP::Lite code to make this method call?
The HTTP request generated by the above is
Accept: text/xml
Accept: multipart/*
Accept: application/soap
Content-Length: 553
Content-Type: text/xml; charset=utf-8
SOAPAction: "http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS#GET_BY_ACCOUNT_NUMBER"
<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<GET_BY_ACCOUNT_NUMBER xmlns="http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS">
<ACCOUNT_NUMBER-VARCHAR2-IN xsi:type="xsd:int">274724</ACCOUNT_NUMBER-VARCHAR2-IN>
</GET_BY_ACCOUNT_NUMBER>
</soap:Body>
</soap:Envelope>
Here is the WSDL file defining the web service:
<definitions name="ACCOUNT_WS"
targetNamespace="http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<xsd:schema targetNamespace="http://xmlns.oracle.com/orawsv/PS_API/ACCOUNT_WS" elementFormDefault="qualified">
<xsd:element name="CACCOUNT_A-GET_BY_ACCOUNT_NUMBERInput">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ACCOUNT_NUMBER-VARCHAR2-IN" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="GET_BY_ACCOUNT_NUMBEROutput">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="RETURN" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
</types>
<message name="GET_BY_ACCOUNT_NUMBERInputMessage">
<part name="parameters" element="tns:CACCOUNT_A-GET_BY_ACCOUNT_NUMBERInput"/>
</message>
<message name="GET_BY_ACCOUNT_NUMBEROutputMessage">
<part name="parameters" element="tns:GET_BY_ACCOUNT_NUMBEROutput"/>
</message>
<portType name="ACCOUNT_WSPortType">
<operation name="GET_BY_ACCOUNT_NUMBER">
<input message="tns:GET_BY_ACCOUNT_NUMBERInputMessage"/>
<output message="tns:GET_BY_ACCOUNT_NUMBEROutputMessage"/>
</operation>
</portType>
<binding name="ACCOUNT_WSBinding" type="tns:ACCOUNT_WSPortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GET_BY_ACCOUNT_NUMBER">
<soap:operation soapAction="GET_BY_ACCOUNT_NUMBER"/>
<input>
<soap:body parts="parameters" use="literal"/>
</input>
<output>
<soap:body parts="parameters" use="literal"/>
</output>
</operation>
</binding>
<service name="ACCOUNT_WSService">
<documentation>Oracle Web Service</documentation>
<port name="ACCOUNT_WSPort" binding="tns:ACCOUNT_WSBinding">
<soap:address location="http://example.com:2222/orawsv/PS_API/ACCOUNT_WS"/>
</port>
</service>
</definitions>
Since you have the WSDL, you shouldn't have to construct SOAP::Data objects at all. Simply load the WSDL into your client object and call the method directly:
my $client = SOAP::WSDL->new(wsdl => $url_of_wsdl);
my $result = $client->$method(#arguments);
Yes, it's that easy!
Looks like this is about a year old, so this might not be relevant any longer. Anyway, based on the soap::lite documentation on CPAN it looks like you want to do this:
my $response = $sObj->call(SOAP::Data->name($method)->attr({ 'xmlns' => $method_urn}),
SOAP::Data->name('parameters')->value(SOAP::Data->value([
SOAP::Data->name('ACCOUNT_NUMBER-VARCHAR2-IN' => '274724'),
]))
);
die $response->fault->{ faultstring } if ($response->fault);
print $response->result, "\n";