Cannot find dispatch method for Request=[SOAPAction="",Payload={http://domain - weblogic

I am newbie to web services, I am trying to create a Weblogic webservice from wsdl.
I am able to work with the service If i have only 1 operation inside wsdl, but if I add second operation, I am receiving the error Cannot find dispatch method for Request=[SOAPAction="",Payload={//domain . I am just adding the operation in portType and binding. . I am really not sure what I am missing.
I have just added operation in portType and binding . . Do I need to change anything else apart from this ?
here is my wsdl
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is
JAX-WS RI 2.2.6hudson-86 svn-revision#12773. -->
<definitions targetNamespace="http://service.training.indus.com/"
name="CalculatorService" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsp="http://www.w3.org/ns/ws-policy"
xmlns:calSvc="http://service.training.indus.com/"
xmlns:calciInOut="http://domain.training.indus.com/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<types>
<xsd:schema>
<xsd:import namespace="http://domain.training.indus.com/"
schemaLocation="../xsd/CalculatorService_schema1.xsd" />
</xsd:schema>
</types>
<message name="calciInputMsg">
<part name="parameters" element="calciInOut:calciInputRequest" />
</message>
<message name="calciOutputMsg">
<part name="parameters" element="calciInOut:calciOutputResponse" />
</message>
<portType name="CalculatorPort">
<operation name="multiply">
<inputwsam:Action="http://service.training.indus.com/Calculator/multiplyRequest"
message="calSvc:calciInputMsg" />
<output wsam:Action="http://service.training.indus.com/Calculator/multiplyResponse"
message="calSvc:calciOutputMsg" />
</operation>
<operation name="addition">
<input wsam:Action="http://service.training.indus.com/Calculator/multiplyRequest"
message="calSvc:calciInputMsg" />
<output
wsam:Action="http://service.training.indus.com/Calculator/multiplyResponse"
message="calSvc:calciOutputMsg" />
</operation>
</portType>
<binding name="CalculatorPortBinding" type="calSvc:CalculatorPort">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="multiply">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
<operation name="addition">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="CalculatorService">
<port name="CalculatorSvcPort" binding="calSvc:CalculatorPortBinding">
<soap:address location="http://localhost:9010/TestTopDown/CalculatorService" />
</port>
</service>
</definitions>

Is because of this:
<soap:operation soapAction="" />
To solve your problem, put this in your method in your class:
#WebMethod(action="add")

Related

Action and soapAction compatibility with Java and WCF

I’m working on WCF but I have a problem, the WSDL generated in Java that was provided, has some configuration that does not match with WCF configuration.
The point is that the WSDL requires to set the Action in the portType operations but to set the soapAction empty in binding Attribute as follows:
This is what I need:
<portType name="Service1">
<operation name="operation1">
<input wsam:Action="http://www. wwwmyUrl.com / Service1/ operation1Request" message="tns: operation1 "/>
<output wsam:Action="http://www. wwwmyUrl.com / Service1/ operation1Response" message="tns: operation1 Response"/>
</operation>
</portType>
<binding name="Service1ImplPortBinding" type="tns: Service1 ">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name=" operation1">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
I set the attribute in the Interface operation
[System.ServiceModel.OperationContractAttribute(Action="", ReplyAction= "")]
but it removes the Action from the porType and it does not match with the required.
This is the Result:
<portType name="Service1">
<operation name="operation1">
<input wsam:Action=" " message="tns: operation1 "/>
<output wsam:Action=" " message="tns: operation1 Response"/>
</operation>
</portType>
<binding name="Service1ImplPortBinding" type="tns: Service1 ">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
<operation name=" operation1">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>

Namespace not matching in WLS Published WSDL for JAX-WS RPC Style webservice

After deploying a JAX-WS, RPC Style webservice, the WSDL published in
Weblogic server 12.1.3 does not corresponds to initial WSDL. The namespace in
is not matching.
ISSUE:
Initial WSDL Contains:
<soap12:body parts="helloReq" use="literal" namespace=""/>
Published WSDL Contains:
<soap12:body use="literal" namespace="http://sample"/>
Due to this, inappropriate SOAP Request is getting formed which is throwing
error on invocation : "Cannot find dispatch method for {}hello".
Initial WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<types>
<xsd:schema targetNamespace="http://sample">
<xsd:complexType name="hello">
<xsd:sequence>
<xsd:element type="xsd:string" name="input" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="helloResponse">
<xsd:sequence>
<xsd:element type="xsd:string" name="output" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</types>
<message name="hello">
<part name="helloReq" type="tns:hello" />
</message>
<message name="helloResponse">
<part name="helloRes" type="tns:helloResponse" />
</message>
<portType name="HelloServicePort">
<operation name="hello">
<input message="tns:hello" />
<output message="tns:helloResponse" />
</operation>
</portType>
<binding type="tns:HelloServicePort" name="HelloServicePort">
<soap12:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="hello">
<soap12:operation style="rpc" soapAction="" />
<input>
<soap12:body parts="helloReq" use="literal" namespace="" />
</input>
<output>
<soap12:body parts="helloRes" use="literal" namespace="" />
</output>
</operation>
</binding>
<service name="HelloService">
<port name="HelloServicePort" binding="tns:HelloServicePort">
<soap12:address location="http://localhost:7201/hello/HelloService" />
</port>
</service>
Published 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:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:tns="http://sample"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://sample" name="HelloService">
<types>
<xsd:schema>
<xsd:import namespace="http://sample"
schemaLocation="http://localhost:7022/hello/jaxws/HelloService?xsd=1" />
</xsd:schema>
</types>
<message name="hello">
<part name="helloReq" type="tns:hello" />
</message>
<message name="helloResponse">
<part name="helloRes" type="tns:helloResponse" />
</message>
<portType name="HelloServicePort">
<operation name="hello">
<input wsam:Action="http://sample/HelloServicePort/helloRequest"
message="tns:hello" />
<output wsam:Action="http://sample/HelloServicePort/helloResponse"
message="tns:helloResponse" />
</operation>
</portType>
<binding name="HelloServicePortBinding" type="tns:HelloServicePort">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"
style="rpc" />
<operation name="hello">
<soap12:operation soapAction="" />
<input>
<soap12:body use="literal" namespace="http://sample" />
</input>
<output>
<soap12:body use="literal" namespace="http://sample" />
</output>
</operation>
</binding>
<service name="HelloService">
<port name="HelloServicePort" binding="tns:HelloServicePortBinding">
<soap12:address location="http://localhost:7022/hello/jaxws/HelloService" />
</port>
</service>
Is this the default behavior or a bug in JAX-WS? Is there any workaround to make this work without changing the wsdl?
Please share some pointers.
Thanks.

Magento Custom Api Code can't pass in parameters (Undefined variable error)

Hello fellow Magento hackers,
I am trying to create a custom API handler and while I can get the function to run, passing in variables for some reason does not work and I get an empty parameter called in. System.log returns the error: DEBUG (7): Undefined variable: inputvar. Please help!
First things first, my directory structure at app/code/local is as follows:
Company
-Customapi
-etc
-api.xml
-config.xml
-wsdl.xml
-Model
-Order
-Api.php
-Api
-V2.php
Now for the code.
Api.php
class Company_Customapi_Model_Order_Api extends Mage_Api_Model_Resource_Abstract
{
public function test($inputvar){
echo $inputvar;
$result = $inputvar;
return $result;
}
}
V2.php
class Company_Customapi_Model_Order_Api_V2 extends Company_Customapi_Model_Order_Api {}
wsdl.xml:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"
schemaLocation="http://schemas.xmlsoap.org/soap/encoding/"/>
</schema>
</types>
<message name="getTestRequest">
<part name="inputvar" type="xsd:string"/>
</message>
<message name="getTestResponse">
<part name="result" type="xsd:string"/>
</message>
<portType name="{{var wsdl.handler}}PortType">
<operation name="customapiOrderTest">
<documentation>Test the API.</documentation>
<input message="typens:getTestRequest"/>
<output message="typens:getTestResponse"/>
</operation>
</portType>
<binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="customapiOrderTest">
<soap:operation soapAction="urn:{{var wsdl.handler}}Action"/>
<input>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body namespace="urn:{{var wsdl.name}}" use="encoded"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="{{var wsdl.name}}Service">
<port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
<soap:address location="{{var wsdl.url}}"/>
</port>
</service>
</definitions>
api.xml:
<?xml version="1.0"?>
<config>
<api>
<resources>
<customapi_order translate="title" module="company_customapi">
<model>company_customapi_model_order_api</model>
<title>company Order API</title>
<acl>order</acl>
<methods>
<test translate="title" module="company_customapi">
<title>A test function.</title>
<acl>test</acl>
</test>
</methods>
</customapi_order>
</resources>
<v2>
<resources_function_prefix>
<customapi_order>customapiOrder</customapi_order>
<!-- prefix+functionname = customapiOrderTest -->
</resources_function_prefix>
</v2>
</api>
</config>
config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Company_Customapi>
<version>0.1.0</version>
</Company_Customapi>
</modules>
<global>
<models>
<Company_Customapi>
<class>Company_Customapi_Model</class>
</Company_Customapi>
</models>
</global>
</config>
test.php:
$session = $client->login(SOAP_USER, SOAP_PASS);
$result = $client->customapiOrderTest($session, "inputvaluehere");
var_dump ( $result);
Found the answer. In Wsdl.xml you have to specify the session parameter as one of your inputs (your function on the server can't see it but you do pass it in from the client)
<message name="getTestRequest">
<part name="sessionId" type="xsd:string"/>
<part name="inputvar" type="xsd:string"/>
</message>
Only took me 2 days to find the answer. Don't you just love Magento!

apache camel cxf https not working

I am trying to publish a webservice using apache camel cxf. I am able to access the published webservice using http. However I am trying to configure the same using https. But I am not able to get it to work.
below are parts of spring context and wsdl files
<camel-cxf:cxfEndpoint id="myEndoint"
address="http://localhost:9000/PostXml/" serviceClass="com.XXXXXXXXXX.techquest.ServicesPortType"
xmlns:ssp="http://techquest.interswitchng.com/" endpointName="ssp:PostXml"
serviceName="ssp:PostXml" />
<http:conduit name="*.http-conduit">
<http:tlsClientParameters
secureSocketProtocol="SSL">
<sec:keyManagers keyPassword="password">
<sec:keyStore type="JKS" password="password"
file="A:/apache-sermfino_conf/cherry.jks" />
</sec:keyManagers>
<sec:trustManagers>
<sec:keyStore type="JKS" password="password"
file="A:/apache-ser/truststore.jks" />
</sec:trustManagers>
<sec:cipherSuitesFilter>
<!-- these filters ensure that a ciphersuite with export-suitable or
null encryption is used, but exclude anonymous Diffie-Hellman key change
as this is vulnerable to man-in-the-middle attacks -->
<sec:include>.*_EXPORT_.*</sec:include>
<sec:include>.*_EXPORT1024_.*</sec:include>
<sec:include>.*_WITH_DES_.*</sec:include>
<sec:include>.*_WITH_AES_.*</sec:include>
<sec:include>.*_WITH_NULL_.*</sec:include>
<sec:exclude>.*_DH_anon_.*</sec:exclude>
</sec:cipherSuitesFilter>
</http:tlsClientParameters>
<http:client AutoRedirect="true" Connection="Keep-Alive" />
</http:conduit>
===============================================================================
<wsdl:portType name="ServicesPortType">
<wsdl:operation name="PostXml">
<wsdl:input message="tns:PostXml" />
<wsdl:output message="tns:PostXml" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServicesSoap12Binding" type="tns:ServicesPortType">
<soap12:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="PostXml">
<soap12:operation soapAction="PostXml" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ServicesPortTypeService">
<wsdl:port binding="tns:ServicesSoap12Binding" name="ServicesSoap12Endpoint">
<soap12:address location="http://localhost:9000/PostXml" />
</wsdl:port>
</wsdl:service>
The first one configuration is for the http client not for the server side.
You can find the configuration example here[1]
[1]http://cxf.apache.org/docs/jetty-configuration.html
I was able to configure apache-camel-2.19.4 with camel-config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
xmlns:cxf="http://camel.apache.org/schema/cxf" xmlns:context="http://www.springframework.org/schema/context"
xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:cxfcore="http://cxf.apache.org/core"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd
http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd
http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
">
<cxf:cxfEndpoint id="my-endpoint-http"
address="http://localhost:8080/test"
endpointName="tns:endpointName1" serviceName="tns:endpointServiceName1"
wsdlURL="myService.wsdl" xmlns:tns="myServiceWsdlNamespace">
<cxf:properties>
<entry key="allowStreaming" value="true" />
<entry key="autoRewriteSoapAddressForAllServices" value="true" />
</cxf:properties>
</cxf:cxfEndpoint>
<cxf:cxfEndpoint id="my-endpoint-https"
address="https://localhost:8443/test"
endpointName="tns:endpointName1" serviceName="tns:endpointServiceName1"
wsdlURL="myService.wsdl" xmlns:tns="myServiceWsdlNamespace">
<cxf:properties>
<entry key="allowStreaming" value="true" />
<entry key="autoRewriteSoapAddressForAllServices" value="true" />
</cxf:properties>
</cxf:cxfEndpoint>
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route id="my-endpoint-http-route" streamCache="true">
<from uri="cxf:bean:my-endpoint-http?dataFormat=MESSAGE" />
<to uri="direct:myServiceDirect" />
</route>
<route id="my-endpoint-https-route" streamCache="true">
<from uri="cxf:bean:my-endpoint-https?dataFormat=MESSAGE" />
<to uri="direct:myServiceDirect" />
</route>
<route id="all" streamCache="true">
<from uri="direct:myServiceDirect" />
<log message="headers1=${headers}" />
</route>
</camelContext>
<cxfcore:bus/>
<httpj:engine-factory bus="cxf">
<httpj:engine port="8443">
<httpj:tlsServerParameters secureSocketProtocol="TLSv1">
<sec:keyManagers keyPassword="skpass">
<sec:keyStore password="changeit" file="src/test/resources/certificate-stores/localhost-keystore.jks" />
</sec:keyManagers>
<!--
<sec:trustManagers>
- <sec:keyStore resource="certs/serviceKeystore.jks" password="sspass" type="JKS"/> -
<sec:keyStore password="changeit" file="src/main/resources/certificate-stores/cacerts" />
</sec:trustManagers>
-->
<sec:cipherSuitesFilter>
<sec:include>.*_WITH_3DES_.*</sec:include>
<sec:include>.*_WITH_DES_.*</sec:include>
<sec:exclude>.*_WITH_NULL_.*</sec:exclude>
<sec:exclude>.*_DH_anon_.*</sec:exclude>
</sec:cipherSuitesFilter>
<!-- <sec:clientAuthentication want="true" required="false"/> -->
</httpj:tlsServerParameters>
</httpj:engine>
</httpj:engine-factory>
</beans>
With this you should be able to access:
http://localhost:8080/test?wsdl
https://localhost:8443/test?wsdl
The file src/test/resources/certificate-stores/localhost-keystore.jks should contain a generated key pair (use KeyStoreExplorer) and the pair saved with keyPassword(skpass) key password and password(changeit) for the keystore file password.

Axis2 client Unexpected subelement apple

I developed both a server and client application using Axis2 version 1.5.4, Java 1.6 and the server is deployed on tomcat 6.
The services are declared using annotations, so there is no .aar files or anything of that sort.
The WSDL was created automatically by Axis2.
The client was made using the stubs and parameters generated by WSDL2Java using the command:
%axis2_home%\bin\WSDL2Java -p com.audaxys.leaseclient.servicestub.generic -d adb -Eosv -s -g -u -uw -or -sp -S src/main/java -R src/main/resources --noBuildXML -uri %baseurl%/AppleFinderService.Rpc?wsdl
When the client app calls the method public Apple loadApple(String appType) the server responds returning one instance of Apple class, but the client is unable to de-serialize the response and throws this exception.
If you know how to fix this, could you please share it with me?
Any clues would be greatly appreciated, really!
Full stack trace:
org.apache.axis2.AxisFault: org.apache.axis2.databinding.ADBException: Unexpected subelement apple
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at com.audaxys.leaseclient.servicestub.generic.AppleFinderServiceStub.fromOM(AppleFinderServiceStub.java:1015)
at com.audaxys.leaseclient.servicestub.generic.AppleFinderServiceStub.loadApple(AppleFinderServiceStub.java:343)
at com.audaxys.lease.ws.client.TestDummyServices.testLoadApple(TestDummyServices.java:107)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.Exception: org.apache.axis2.databinding.ADBException: Unexpected subelement apple
at com.audaxys.www.namespaces.leasews.LoadAppleResponse$Factory.parse(LoadAppleResponse.java:454)
at com.audaxys.leaseclient.servicestub.generic.AppleFinderServiceStub.fromOM(AppleFinderServiceStub.java:981)
... 18 more
Caused by: org.apache.axis2.databinding.ADBException: Unexpected subelement apple
at com.audaxys.www.namespaces.leasews.LoadAppleResponse$Factory.parse(LoadAppleResponse.java:448)
... 19 more
ServiceDeclaration
package com.audaxys.lease.model.generic;
import .....;
#WebService(name="AppleFinderService", serviceName="AppleFinderService", portName="Rpc", targetNamespace="http://www.audaxys.com/namespaces/leasews")
#SOAPBinding(style = Style.RPC, parameterStyle = ParameterStyle.WRAPPED)
public class AppleFinderImpl {
#WebResult(name = "apple")
public Apple loadApple(String appType) {
Apple a = new Apple();
a.setAppleType(appType);
return a;
}
}
Apple class
package com.audaxys.lease.model.generic;
import javax.xml.bind.annotation.XmlRootElement;
#XmlRootElement(namespace="http://www.audaxys.com/namespaces/leasews")
public class Apple {
private String appleType;
public Apple() {
super();
}
public String getAppleType() {
return appleType;
}
public void setAppleType(String appleType) {
this.appleType = appleType;
}
}
WSDL
<?xml version="1.0" encoding="UTF-8" ?>
<definitions name="AppleFinderService" targetNamespace="http://www.audaxys.com/namespaces/leasews" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.audaxys.com/namespaces/leasews" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:ns1="http://jaxb.dev.java.net/array">
<types>
<xsd:schema>
<xsd:import namespace="http://www.audaxys.com/namespaces/leasews" schemaLocation="AppleFinderService.Rpc?xsd=AppleFinderService_schema1.xsd" />
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://jaxb.dev.java.net/array" schemaLocation="AppleFinderService.Rpc?xsd=AppleFinderService_schema2.xsd" />
</xsd:schema>
</types>
<message name="loadAppleResponse">
<part name="apple" type="tns:apple" />
</message>
<message name="getAppleArray">
<part name="arg0" type="xsd:string" />
</message>
<message name="loadApple">
<part name="arg0" type="xsd:string" />
</message>
<portType name="AppleFinderService">
<operation name="getAppleArray">
<input message="tns:getAppleArray" />
<output message="tns:getAppleArrayResponse" />
</operation>
<operation name="loadApple">
<input message="tns:loadApple" />
<output message="tns:loadAppleResponse" />
</operation>
</portType>
<binding name="RpcBinding" type="tns:AppleFinderService">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="getAppleArray">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://www.audaxys.com/namespaces/leasews" />
</input>
<output>
<soap:body use="literal" namespace="http://www.audaxys.com/namespaces/leasews" />
</output>
</operation>
<operation name="loadApple">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" namespace="http://www.audaxys.com/namespaces/leasews" />
</input>
<output>
<soap:body use="literal" namespace="http://www.audaxys.com/namespaces/leasews" />
</output>
</operation>
</binding>
<service name="AppleFinderService">
<port name="Rpc" binding="tns:RpcBinding">
<soap:address location="http://10.10.5.25:8080/lease.services/soap/services/AppleFinderService.Rpc/" />
</port>
</service>
</definitions>
XSD
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.audaxys.com/namespaces/leasews" attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://www.audaxys.com/namespaces/leasews">
<xs:element name="apple" type="tns:apple" />
<xs:complexType name="apple">
<xs:sequence>
<xs:element minOccurs="0" name="appleType" type="xs:string" />
</xs:sequence>
</xs:complexType>
<xs:complexType final="#all" name="appleArray">
<xs:sequence>
<xs:element maxOccurs="unbounded" minOccurs="0" name="item" nillable="true" type="tns:apple" />
</xs:sequence>
</xs:complexType>
</xs:schema>
Request
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<loadApple xmlns="http://www.audaxys.com/namespaces/leasews">
<arg0>Red</arg0>
</loadApple>
</soapenv:Body>
</soapenv:Envelope>
Responsse
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<rpcOp:loadAppleResponse xmlns:rpcOp="http://www.audaxys.com/namespaces/leasews">
<rpcOp:apple xmlns:ns3="http://com.audaxys.lease/" xmlns="">
<appleType>Red</appleType>
</rpcOp:apple>
</rpcOp:loadAppleResponse>
</soapenv:Body>
</soapenv:Envelope>
Your post is hard to read but I believe the problem is in the WSDL and XSD. You have an element, complexType and message part all with the same name "apple". I would try reworking the WSDL following the convention here:
<element name="Apple" type="tns:AppleType"/>
<complexType name="AppleType">
...
</complexType>
<message name="loadAppleResponse">
<part name="apple" element="tns:Apple"/>
</message>
I have faced the similiar kind of problem, I have annotated the EJB SLSB using JAX-WS API's and used RPC as the SOAP Bindind style.Deployed the EJB in JBoss5.1 and JBOSSWS generates the WSDL.
When I tested the Web Services by Axis1 client it worked fine, But while testing with Axis2 client, the request has sent to the server and even the DB transactions also was successfull.
But when the response came to the client, it says the Unexpected subelement return and so on. Then I changed the SOAP binding style it worked with Axis2.
#WebService
#SOAPBinding(style=Style.DOCUMENT, parameterStyle = ParameterStyle.WRAPPED)
public interface BillingAccountManagement_SEI { // TODO}