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.
Related
I have following scenario:
There are many sites/departments and every site has it's own ServiceMix and different number of databases. Those databases are grouped, for example there are two groups: production_one and production_two.
On every site I deployed bundles as a datasource, one datasource for every database.
Datasource: blueprint.xml
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<!-- Properties -->
<!-- blueprint property placeholders, that will use etc/datasources.cfg as the properties file -->
<cm:property-placeholder id="db.placeholder" persistent-id="datasources">
</cm:property-placeholder>
<!-- Datasource -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="url"
value="jdbc:sqlserver://${bundle_ds_1_db_host}:${bundle_ds_1_db_port};databaseName=${bundle_ds_1_db_database};" />
<property name="username" value="${bundle_ds_1_db_username}" />
<property name="password" value="${bundle_ds_1_db_password}" />
</bean>
<!-- Init database-->
<bean id="initDatabase"
class="com.xyz.mssql.ds.DatabaseInitBean"
init-method="create" destroy-method="destroy">
<property name="ds" ref="dataSource" />
</bean>
<service ref="dataSource" interface="javax.sql.DataSource">
<service-properties>
<entry key="datasource.name" value="${bundle_ds_1_ds_name}" />
<entry key="datasource.type" value="${bundle_ds_1_ds_type}" />
<entry key="datasource.id" value="${bundle_ds_1_ds_id}" />
<entry key="datasource.group_id" value="${bundle_ds_1_ds_group_id}" />
</service-properties>
</service>
There is also bundle, which receives a SOAP message via cxf and process it by calling database:
CXF: blueprint.xml
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd
http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<cxf:cxfEndpoint id="processXEndpoint" address="/mssql-soap1/"
serviceClass="com.xyz.mssql.soap1.ProcessXService" />
<bean id="saveDataProcessor"
class="com.xyz.mssql.soap1.SaveDataProcessor">
<property name="ds" ref="dataSource" />
</bean>
<bean id="getDataProcessor"
class="com.xyz.mssql.soap1.GetDataProcessor">
<property name="ds" ref="dataSource" />
</bean>
<!-- DataSource -->
<reference id="dataSource" interface="javax.sql.DataSource"
filter="(datasource.name=mssql-ds-1)">
<reference-listener bind-method="onBind"
unbind-method="onUnbind">
<bean class="com.xyz.mssql.soap1.ListenerBean" />
</reference-listener>
</reference>
<!-- Camel Context -->
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route id="cxf">
<from uri="cxf:bean:processXEndpoint" />
<recipientList>
<simple>direct:${header.operationName}</simple>
</recipientList>
</route>
<route id="saveRoute">
<from uri="direct:saveData" />
<log message="Calling saveData" />
<process ref="saveDataProcessor" />
</route>
<route id="getRoute">
<from uri="direct:getData" />
<log message="Call getData" />
<process ref="getDataProcessor" />
</route>
</camelContext>
</blueprint>
The problem is, that following code inject to bean (ex: SaveDataProcessor) only one datasource resolved by it's name "datasource.name=mssql-ds-1", but I need to call many databases and on every servicemix installation there will be different number of them.
I need to call all databases (datasources) which have same type, for example "datasource.type=production_one".
Is it possible? How to do it?
How to pass to bean an array of datasources, or call this bean against every datasource which meet same conditions (name, type and so on).
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.
I'm attempting to create user accounts for a vendor tool in batches. I asked the vendor how to turn on the MEX for the endpoint for creating a single account and I adjusted the config file accordingly.
I was able to create a service reference, but all I have in Visual Studio is a client and two interfaces. I can't tell how to create a request. The client has an InvokeService method, but it just takes an object.
I replicated the vendors class structure in my code, but then the service didn't like my type. So, I updated the classes to use the vendor's original namespace, but the service still didn't like it.
Type 'life.businessService.baseBusinessDataModel.BusinessRequest' with data contract name 'BusinessRequest:http://schemas.datacontract.org/2004/07/life.businessService.baseBusinessDataModel' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.
Here's the WSDL from the service. I'm not very strong in WCF, so I'm hoping for some guidance. Thanks!
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:tns="http://tempuri.org/" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 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" name="ClientWcfBusinessFacadeService" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsp:Policy wsu:Id="NetNamedPipeBinding_IWcfBusinessFacade_policy">
<wsp:ExactlyOne>
<wsp:All>
<msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1">
</msb:BinaryEncoding>
<wsaw:UsingAddressing>
</wsaw:UsingAddressing>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsp:Policy wsu:Id="NetTcpBinding_IWcfBusinessFacade_policy">
<wsp:ExactlyOne>
<wsp:All>
<msb:BinaryEncoding xmlns:msb="http://schemas.microsoft.com/ws/06/2004/mspolicy/netbinary1">
</msb:BinaryEncoding>
<wsaw:UsingAddressing>
</wsaw:UsingAddressing>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
<wsdl:types>
<xsd:schema targetNamespace="http://tempuri.org/Imports">
<xsd:import namespace="http://tempuri.org/" />
<xsd:import namespace="http://schemas.datacontract.org/2004/07/life.common.serviceCommon" />
<xsd:import namespace="http://schemas.microsoft.com/2003/10/Serialization/" />
</xsd:schema>
</wsdl:types>
<wsdl:message name="IWcfBusinessFacade_InvokeService_InputMessage">
<wsdl:part name="parameters" element="tns:InvokeService" />
</wsdl:message>
<wsdl:message name="IWcfBusinessFacade_InvokeService_OutputMessage">
<wsdl:part name="parameters" element="tns:InvokeServiceResponse" />
</wsdl:message>
<wsdl:message name="IWcfBusinessFacade_InvokeService_ServiceFaultFault_FaultMessage">
<wsdl:part xmlns:q1="http://schemas.datacontract.org/2004/07/life.common.serviceCommon" name="detail" element="q1:ServiceFault" />
</wsdl:message>
<wsdl:portType name="IWcfBusinessFacade">
<wsdl:operation name="InvokeService">
<wsdl:input wsaw:Action="http://tempuri.org/IWcfBusinessFacade/InvokeService" message="tns:IWcfBusinessFacade_InvokeService_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IWcfBusinessFacade/InvokeServiceResponse" message="tns:IWcfBusinessFacade_InvokeService_OutputMessage" />
<wsdl:fault wsaw:Action="http://tempuri.org/IWcfBusinessFacade/InvokeServiceServiceFaultFault" name="ServiceFaultFault" message="tns:IWcfBusinessFacade_InvokeService_ServiceFaultFault_FaultMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="NetNamedPipeBinding_IWcfBusinessFacade" type="tns:IWcfBusinessFacade">
<wsp:PolicyReference URI="#NetNamedPipeBinding_IWcfBusinessFacade_policy">
</wsp:PolicyReference>
<soap12:binding transport="http://schemas.microsoft.com/soap/named-pipe" />
<wsdl:operation name="InvokeService">
<soap12:operation soapAction="http://tempuri.org/IWcfBusinessFacade/InvokeService" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
<wsdl:fault name="ServiceFaultFault">
<soap12:fault use="literal" name="ServiceFaultFault" namespace="" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="NetTcpBinding_IWcfBusinessFacade" type="tns:IWcfBusinessFacade">
<wsp:PolicyReference URI="#NetTcpBinding_IWcfBusinessFacade_policy">
</wsp:PolicyReference>
<soap12:binding transport="http://schemas.microsoft.com/soap/tcp" />
<wsdl:operation name="InvokeService">
<soap12:operation soapAction="http://tempuri.org/IWcfBusinessFacade/InvokeService" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
<wsdl:fault name="ServiceFaultFault">
<soap12:fault use="literal" name="ServiceFaultFault" namespace="" />
<soap12:fault use="literal" name="ServiceFaultFault" namespace="" />
</wsdl:fault>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ClientWcfBusinessFacadeService">
<wsdl:port name="NetNamedPipeBinding_IWcfBusinessFacade" binding="tns:NetNamedPipeBinding_IWcfBusinessFacade">
<soap12:address location="net.pipe://localhost/WcfBusinessFacadeService" />
<wsa10:EndpointReference>
<wsa10:Address>net.pipe://localhost/WcfBusinessFacadeService</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
<wsdl:port name="NetTcpBinding_IWcfBusinessFacade" binding="tns:NetTcpBinding_IWcfBusinessFacade">
<soap12:address location="net.tcp://localhost:8086/WcfBusinessFacadeService" />
<wsa10:EndpointReference>
<wsa10:Address>net.tcp://localhost:8086/WcfBusinessFacadeService</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
<wsdl:port name="NetTcpBinding_IWcfBusinessFacade1" binding="tns:NetTcpBinding_IWcfBusinessFacade">
<soap12:address location="net.tcp://localhost:10000/WcfBusinessFacadeService" />
<wsa10:EndpointReference>
<wsa10:Address>net.tcp://localhost:10000/WcfBusinessFacadeService</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
For the input message of the InvokeService method, you need to pass the object defined in tns:InvokeService. It will be a type in namespace http://tempuri.org/Imports, but is not explicitly exposed in this WSDL; it is coming from another namespace. You may ask the vendor for the schema XSD or assembly from which this WSDL is expecting to import types below since no absolute or even relative schemaLocation attribute is included
<xsd:import namespace="http://tempuri.org/" />
<xsd:import namespace="http://schemas.datacontract.org/2004/07/life.common.serviceCommon" />
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")
Apparently, it is not a good idea to use an existing domain.xml file, generated when creating a new domain using asadmin create-domain new_domain, and later use it when running an embedded instance of Glassfish. DataSources can not be found etcetera.
This is confirmed on this thread: GLASSFISH-20270
However, my question is, is there any way to get a "embedded version" of the domain.xml file for Glassfish 4.0?
Here is the default domain.xml for Embedded Glassfish 4.0. You can change it and put it in your project.
<domain log-root="${com.sun.aas.instanceRoot}/logs" application-root="${com.sun.aas.instanceRoot}/applications" version="10.0">
<security-configurations>
<authorization-service default="true" name="authorizationService">
<security-provider name="simpleAuthorization" type="Simple" provider-name="simpleAuthorizationProvider">
<authorization-provider-config support-policy-deploy="false" name="simpleAuthorizationProviderConfig"></authorization-provider-config>
</security-provider>
</authorization-service>
</security-configurations>
<system-applications />
<applications />
<resources>
<jdbc-resource pool-name="__TimerPool" jndi-name="jdbc/__TimerPool" object-type="system-admin" />
<jdbc-resource pool-name="DerbyPool" jndi-name="jdbc/__default" object-type="system-all" />
<jdbc-connection-pool name="__TimerPool" datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" res-type="javax.sql.XADataSource">
<property value="${com.sun.aas.instanceRoot}/lib/databases/ejbtimer" name="databaseName" />
<property value=";create=true" name="connectionAttributes" />
</jdbc-connection-pool>
<jdbc-connection-pool is-isolation-level-guaranteed="false" name="DerbyPool" datasource-classname="org.apache.derby.jdbc.EmbeddedDataSource" res-type="javax.sql.DataSource">
<property name="databaseName" value="${com.sun.aas.instanceRoot}/lib/databases/embedded_default" />
<property name="connectionAttributes" value=";create=true" />
</jdbc-connection-pool>
</resources>
<servers>
<server name="server" config-ref="server-config">
<resource-ref ref="jdbc/__TimerPool" />
<resource-ref ref="jdbc/__default" />
</server>
</servers>
<configs>
<config name="server-config">
<http-service>
<access-log rotation-interval-in-minutes="15" rotation-suffix="yyyy-MM-dd" />
<virtual-server id="server" network-listeners="http-listener, https-listener" />
</http-service>
<iiop-service>
<orb use-thread-pool-ids="thread-pool-1" />
<iiop-listener address="0.0.0.0" port="3700" id="orb-listener-1" />
<iiop-listener security-enabled="true" address="0.0.0.0" port="3820" id="SSL">
<ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as" />
</iiop-listener>
<iiop-listener security-enabled="true" address="0.0.0.0" port="3920" id="SSL_MUTUALAUTH">
<ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" cert-nickname="s1as" client-auth-enabled="true" />
</iiop-listener>
</iiop-service>
<admin-service type="das-and-server" system-jmx-connector-name="system">
<jmx-connector enabled="false" auth-realm-name="admin-realm" security-enabled="false" address="0.0.0.0" port="8686" name="system" />
<das-config autodeploy-enabled="false" dynamic-reload-enabled="true" deploy-xml-validation="full" autodeploy-dir="${com.sun.aas.instanceRoot}/autodeploy" />
<property value="/admin" name="adminConsoleContextRoot" />
<property value="${com.sun.aas.installRoot}/lib/install/applications/admingui.war" name="adminConsoleDownloadLocation" />
<property value="${com.sun.aas.installRoot}/.." name="ipsRoot" />
</admin-service>
<connector-service shutdown-timeout-in-seconds="30">
</connector-service>
<ejb-container steady-pool-size="0" max-pool-size="32" session-store="${com.sun.aas.instanceRoot}/session-store" pool-resize-quantity="8">
<ejb-timer-service />
</ejb-container>
<mdb-container steady-pool-size="0" max-pool-size="32" pool-resize-quantity="8" >
</mdb-container>
<jms-service type="EMBEDDED" default-jms-host="default_JMS_host">
<jms-host name="default_JMS_host" host="localhost" port="7676" admin-user-name="admin" admin-password="admin" lazy-init="false"/>
</jms-service>
<log-service file="${com.sun.aas.instanceRoot}/logs/server.log" log-rotation-limit-in-bytes="2000000">
<module-log-levels />
</log-service>
<security-service activate-default-principal-to-role-mapping="true" jacc="simple">
<auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="admin-realm">
<property value="${com.sun.aas.instanceRoot}/config/admin-keyfile" name="file" />
<property value="fileRealm" name="jaas-context" />
</auth-realm>
<auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="file">
<property value="${com.sun.aas.instanceRoot}/config/keyfile" name="file" />
<property value="fileRealm" name="jaas-context" />
</auth-realm>
<auth-realm classname="com.sun.enterprise.security.auth.realm.certificate.CertificateRealm" name="certificate" />
<jacc-provider policy-configuration-factory-provider="com.sun.enterprise.security.provider.PolicyConfigurationFactoryImpl" policy-provider="com.sun.enterprise.security.provider.PolicyWrapper" name="default">
<property value="${com.sun.aas.instanceRoot}/generated/policy" name="repository" />
</jacc-provider>
<jacc-provider policy-configuration-factory-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyConfigurationFactory" policy-provider="com.sun.enterprise.security.jacc.provider.SimplePolicyProvider" name="simple" />
<audit-module classname="com.sun.enterprise.security.ee.Audit" name="default">
<property value="false" name="auditOn" />
</audit-module>
<message-security-config auth-layer="SOAP">
<provider-config provider-id="XWS_ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule" provider-type="client">
<request-policy auth-source="content" />
<response-policy auth-source="content" />
<property value="s1as" name="encryption.key.alias" />
<property value="s1as" name="signature.key.alias" />
<property value="false" name="dynamic.username.password" />
<property value="false" name="debug" />
</provider-config>
<provider-config provider-id="ClientProvider" class-name="com.sun.xml.wss.provider.ClientSecurityAuthModule" provider-type="client">
<request-policy auth-source="content" />
<response-policy auth-source="content" />
<property value="s1as" name="encryption.key.alias" />
<property value="s1as" name="signature.key.alias" />
<property value="false" name="dynamic.username.password" />
<property value="false" name="debug" />
<property value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml" name="security.config" />
</provider-config>
<provider-config provider-id="XWS_ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule" provider-type="server">
<request-policy auth-source="content" />
<response-policy auth-source="content" />
<property value="s1as" name="encryption.key.alias" />
<property value="s1as" name="signature.key.alias" />
<property value="false" name="debug" />
</provider-config>
<provider-config provider-id="ServerProvider" class-name="com.sun.xml.wss.provider.ServerSecurityAuthModule" provider-type="server">
<request-policy auth-source="content" />
<response-policy auth-source="content" />
<property value="s1as" name="encryption.key.alias" />
<property value="s1as" name="signature.key.alias" />
<property value="false" name="debug" />
<property value="${com.sun.aas.instanceRoot}/config/wss-server-config-1.0.xml" name="security.config" />
</provider-config>
</message-security-config>
<property value="SHA-256" name="default-digest-algorithm" />
</security-service>
<monitoring-service>
<module-monitoring-levels />
</monitoring-service>
<transaction-service tx-log-dir="${com.sun.aas.instanceRoot}/logs" >
</transaction-service>
<java-config>
<jvm-options>-Djavax.net.ssl.keyStore=${com.sun.aas.instanceRoot}/config/keystore.jks</jvm-options>
<jvm-options>-Djavax.net.ssl.trustStore=${com.sun.aas.instanceRoot}/config/cacerts.jks</jvm-options>
<jvm-options>-Dorg.glassfish.jms.InitializeOnDemand=true</jvm-options>
</java-config>
<network-config>
<protocols>
<protocol name="http-listener">
<http default-virtual-server="server" max-connections="250">
<file-cache enabled="false"></file-cache>
</http>
</protocol>
<protocol security-enabled="true" name="https-listener">
<http default-virtual-server="server" max-connections="250">
<file-cache enabled="false"></file-cache>
</http>
<ssl classname="com.sun.enterprise.security.ssl.GlassfishSSLImpl" ssl3-enabled="false" cert-nickname="s1as"></ssl>
</protocol>
</protocols>
<network-listeners>
<network-listener port="0" protocol="http-listener" transport="tcp" name="http-listener" thread-pool="http-thread-pool" enabled="false" />
<network-listener port="0" protocol="https-listener" transport="tcp" name="https-listener" thread-pool="http-thread-pool" enabled="false" />
</network-listeners>
<transports>
<transport name="tcp"></transport>
</transports>
</network-config>
<thread-pools>
<thread-pool name="http-thread-pool" max-queue-size="4096"></thread-pool>
<thread-pool name="thread-pool-1" max-thread-pool-size="200"/>
</thread-pools>
</config>
</configs>
<property name="administrative.domain.name" value="domain1"/>