Deploy .war developed in jdeveloper on glassfish4.0 - web-services

I developed a .war file in jdeveloper 10.1.3. And I want to deploy it on glassfish4.0 server which is standalone server.
Firstly I write a java code as
package com.oi.testdemohello;
public class TestHello {
public TestHello() {
}
public String sayHello(String name){
return "Hello "+name;
}
}
Than I create a J2EE1.4(JAX-RPC) and SOAP 1.1 Binding web services from that code in jdeveloper which statefull service.
The WSDL generated is as :
<definitions
name="MyWebService"
targetNamespace="http://testdemohello.oi.com/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:tns="http://testdemohello.oi.com/"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns0="http://testdemohello.oi.com/types/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://testdemohello.oi.com/types/"
elementFormDefault="qualified" xmlns:tns="http://testdemohello.oi.com/types/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soap11-enc="http://schemas.xmlsoap.org/soap/encoding/">
<element name="sayHelloElement">
<complexType>
<sequence>
<element name="name" type="string" nillable="true"/>
</sequence>
</complexType>
</element>
<element name="sayHelloResponseElement">
<complexType>
<sequence>
<element name="result" type="string" nillable="true"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="MyWebService_sayHello">
<part name="parameters" element="tns0:sayHelloElement"/>
</message>
<message name="MyWebService_sayHelloResponse">
<part name="parameters" element="tns0:sayHelloResponseElement"/>
</message>
<portType name="MyWebService">
<operation name="sayHello">
<input message="tns:MyWebService_sayHello"/>
<output message="tns:MyWebService_sayHelloResponse"/>
</operation>
</portType>
<binding name="MyWebServiceSoapHttp" type="tns:MyWebService">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="sayHello">
<soap:operation soapAction="http://testdemohello.oi.com//sayHello"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="MyWebService">
<port name="MyWebServiceSoapHttpPort" binding="tns:MyWebServiceSoapHttp">
<soap:address location="http://localMachine3:8888/TestDemoHello-DemoHello-context-root/MyWebServiceSoapHttpPort"/>
</port>
</service>
Than I deploy a .war file of this.
Now I want to deploy this .war file to glassfish 4.0 server. But I am not able to do it. How to do it please suggest me.

There are different options, outlined for example in this question: Best way to deploy on Glassfish V3. Your easiest option is to use the Glassfish Admin GUI on http://localhost:4848.
If you want something that is integrated in JDeveloper you can try GlassFish Extension for Oracle JDeveloper or read this article and this question.

Related

XML/C++ type binding goes wrong

I have a WSDL file which I need to generate a c++ web service code from it. The toolchain I'm using is gSOAP.
The problem is that the generated server class, have a function for each operation with parameters as char* instead of something like ns2__something structs. How can I force gSOAP to generate XML/C or XML/C++ binding (according to my understanding of gSOAP documentation it should do so [?])
WSDL file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="swus"
targetNamespace="swus.wsdl"
xmlns:tns="swus.wsdl"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns="urn:swus"
xmlns:SOAP="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:MIME="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:DIME="http://schemas.xmlsoap.org/ws/2002/04/dime/wsdl/"
xmlns:WSDL="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
<schema targetNamespace="urn:swus"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns="urn:swus"
xmlns="http://www.w3.org/2001/XMLSchema"
elementFormDefault="unqualified"
attributeFormDefault="unqualified">
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<element name="addRequestElement">
<complexType>
<sequence>
<element name="a" type="xsd:double"></xsd:element>
<element name="b" type="xsd:double"></xsd:element>
</sequence>
</complexType>
</element>
<element name="addResponseElement">
<complexType>
<sequence>
<element name="result" type="xsd:double"></xsd:element>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="addRequest">
<part name="parameters" element="addRequestElement"/>
</message>
<message name="addResponse">
<part name="result" element="addResponseElement"/>
</message>
<portType name="calcPortType">
<operation name="add">
<input message="tns:addRequest"/>
<output message="tns:addResponse"/>
</operation>
</portType>
<binding name="swus" type="tns:calcPortType">
<SOAP:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="add">
<SOAP:operation style="document" soapAction=""/>
<input>
<SOAP:body use="literal" namespace="urn:swus" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<SOAP:body use="literal" namespace="urn:swus" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="swus">
<port name="swus" binding="tns:swus">
<SOAP:address location=""/>
</port>
</service>
</definitions>
gSOAP parameters:
wsdl2h -c++11 -g -a -w -y -oSWUS.h ../docs/service.wsdl
soapcpp2 -2 -S -a -A -t -c++11 -b -i ./SWUS.h
Generated code snippet:
class SOAP_CMAC swusService : public soap {
public:
/* blah blah blah... */
/// Web service operation 'add' (returns SOAP_OK or error code)
virtual int add(char *wsdl__addRequestElement, // =====>> Why?
char *wsdl__addResponseElement // =====>> Why?
) SOAP_PURE_VIRTUAL;
};
The WSDL file is mixing two namespaces (tns and swus).
Add swus: to the request and response element types:
<message name="addRequest">
<part name="parameters" element="swus:addRequestElement"/>
</message>
<message name="addResponse">
<part name="result" element="swus:addResponseElement"/>
</message>
gSOAP should match now the correct types:
virtual int add(
_ns2__addRequestElement *ns2__addRequestElement,
_ns2__addResponseElement &ns2__addResponseElement
) SOAP_PURE_VIRTUAL;

SOAPUI error: does not close tag

When starting a SOAPUI SOAP project (from my local computer) using the following URL (on a server in my own network):
http://myinternaldomainname/test2?wsdl
The following error occurs:
Error loading [http://myinternaldomainname/test2?wsdl]:
org.apache.xmlbeans.XmlException: org.apache.xmlbeans.XmlException:
error: does not close tag
The server is added to my hosts file:
192.168.2.1 myexampledomain
When I store the result of the WSDL page as a wsdl file, I can open the WSDL file as new SOAP project.
I used Zend\Soap\Autodiscovery to generate this WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://myexampledomain/test2" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="MySoapService" targetNamespace="http://myexampledomain/test2">
<types>
<xsd:schema targetNamespace="http://myexampledomain/test2"/>
</types>
<portType name="MySoapServicePort">
<operation name="method1">
<documentation>This method takes ...</documentation>
<input message="tns:method1In"/>
<output message="tns:method1Out"/>
</operation>
<operation name="method2">
<documentation>This method takes ...</documentation>
<input message="tns:method2In"/>
<output message="tns:method2Out"/>
</operation>
</portType>
<binding name="MySoapServiceBinding" type="tns:MySoapServicePort">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="method1">
<soap:operation soapAction="http://myexampledomain/test2#method1"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://myexampledomain/test2"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://myexampledomain/test2"/>
</output>
</operation>
<operation name="method2">
<soap:operation soapAction="http://myexampledomain/test2#method2"/>
<input>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://myexampledomain/test2"/>
</input>
<output>
<soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://myexampledomain/test2"/>
</output>
</operation>
</binding>
<service name="MySoapServiceService">
<port name="MySoapServicePort" binding="tns:MySoapServiceBinding">
<soap:address location="http://myexampledomain/test2"/>
</port>
</service>
<message name="method1In">
<part name="inputParam" type="xsd:int"/>
</message>
<message name="method1Out">
<part name="return" type="xsd:string"/>
</message>
<message name="method2In">
<part name="inputParam1" type="xsd:int"/>
<part name="inputParam2" type="xsd:string"/>
</message>
<message name="method2Out">
<part name="return" type="xsd:float"/>
</message>
</definitions>
In SOAPUI I tried proxy disabled/enabled/automatic
If someone ever encounters this problem, what worked for me was hitting CTRL + ALT + P and setting the Proxy Settings to None
Please disable proxy by using CTRL+ALT+P and disable system firewall. hopefully it will work.
The problem was caused because a login page prevented me to use the WSDL in SOAP UI.

Couldn't find <definitions> in WSDL

i tried to develop my first SOAP webservice, but i'm stuck with an error when i try to open my WSDL with wizdl. I got this error :
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>WSDL</faultcode>
<faultstring>
SOAP-ERROR: Parsing WSDL: Couldn't find <definitions> in
'http://localhost/testSolution/test.wsdl'
</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Here is my code : testSolution.php :
<?php
class Ws{
function getString()
{
return "TESTASTOS";
}
}
ini_set("soap.wsdl_cache_enabled", 0);
$serversoap = new SoapServer("http://localhost/testSolution/test.wsdl");
$serversoap->setClass("Ws");
$serversoap->handle();
?>
And test.wsdl :
<?xml version="1.0" encoding="iso-8859-1"?>
<definitions
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl"
targetNamespace="urn:serviceTestwsdl"
xmlns:tns="urn:serviceTestwsdl"
>
<types>
<xsd:schema targetNamespace="urn:serviceTestwsdl"/>
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
</types>
<message name="getStringRequest">
</message>
<message name="getStringResponse">
<part name="return" type="xsd:string" />
</message>
<portType name="serviceTestPortType">
<operation name="getString">
<documentation>Récupère un string</documentation>
<input message="tns:getStringRequest"/>
<output message="tns:getStringResponse"/>
</operation>
</portType>
<binding name="serviceTestBinding" type="tns:serviceTestPortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getString">
<soap:operation soapAction="urn:serviceTestwsdl#getString" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:serviceTestwsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:serviceTestwsdl"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="serviceTest">
<port name="serviceTestPort" binding="tns:serviceTestBinding">
<soap:address location="http://localhost/testSolution/testSolution.php"/>
</port>
</service>
</definitions>
The mainly goal is to understand how a soap webservice work by making a small hello world on string.
Thanks a lot for your Help
Regards. Didier
You need to add the "wsdl" prefix like <wsdl:definitions> in the test.wsdl. Also to the first level of elements within that param:
<wsdl:types>...</wsdl:types>
<wsdl:operation>...</wsdl:operation>
... etc
This will allow you to load the wsdl.

java.lang.ClassCastException: org.jboss.ws.core.soap.TextImpl cannot be cast to javax.xml.soap.SOAPElement

I am working on IBM Sterling V 9.3. I have exposed an Service as JAX-WS web service using the steps provided in the knowledge center successfully on Jboss 4.2.3 app server. EAR file got deployed successfully and app server started fine. I could see the generated WSDL file for the web service.
When I tried to access the WSDL from soapUI tool (version 3.5.1), I am getting the following error in the response message. I searched for the same and found out that we should have following jars under JBOSS_HOME\lib\endorsed folder:
• jboss-saaj.jar
• jboss-jaxws.jar
• jboss-jaxrpc.jar
• jaxb-api-2.1.9.jar
• xercesImpl.jar
• xalan.jar
• serializer.jar
I have added above jars but still getting the same error. Can share the more details if required. Please help.
Error message:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<env:Fault>
<faultcode>env:Server</faultcode>
<faultstring>java.lang.ClassCastException: org.jboss.ws.core.soap.TextImpl cannot be cast to javax.xml.soap.SOAPElement</faultstring>
</env:Fault>
</env:Body>
</env:Envelope>
WSDL file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions name="SearsBeansService"
targetNamespace="http://webservices.sears.com/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://webservices.sears.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<types>
<xsd:schema>
<xsd:import
namespace="http://webservices.sears.com/documentation/SearsGetOrderListForWSCService/searsGetOrderListForWSCService/output" schemaLocation="SearsBeansService_schema1.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import
namespace="http://webservices.sears.com/documentation/SearsGetOrderListForWSCService/searsGetOrderListForWSCService/input" schemaLocation="SearsBeansService_schema2.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import
namespace="http://webservices.sears.com/documentation/SearsGetOrderDetailsForWSCService/searsGetOrderDetailsForWSCService/output" schemaLocation="SearsBeansService_schema3.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import
namespace="http://webservices.sears.com/documentation/SearsGetOrderDetailsForWSCService/searsGetOrderDetailsForWSCService/input" schemaLocation="SearsBeansService_schema4.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import namespace="http://webservices.sears.com/" schemaLocation="SearsBeansService_schema5.xsd"/>
</xsd:schema>
<xsd:schema>
<xsd:import
namespace="http://www.sterlingcommerce.com/documentation/types" schemaLocation="yfctype.xsd"/>
</xsd:schema>
</types>
<message name="searsGetOrderDetailsForWSCService">
<part element="tns:searsGetOrderDetailsForWSCService" name="parameters"/>
</message>
<message name="searsGetOrderDetailsForWSCServiceResponse">
<part element="tns:searsGetOrderDetailsForWSCServiceResponse" name="parameters"/>
</message>
<message name="XBeanWSException">
<part element="tns:XBeanWSException" name="fault"/>
</message>
<message name="searsGetOrderListForWSCService">
<part element="tns:searsGetOrderListForWSCService" name="parameters"/>
</message>
<message name="searsGetOrderListForWSCServiceResponse">
<part element="tns:searsGetOrderListForWSCServiceResponse" name="parameters"/>
</message>
<portType name="SearsBeans">
<operation name="searsGetOrderDetailsForWSCService">
<input message="tns:searsGetOrderDetailsForWSCService"/>
<output message="tns:searsGetOrderDetailsForWSCServiceResponse"/>
<fault message="tns:XBeanWSException" name="XBeanWSException"/>
</operation>
<operation name="searsGetOrderListForWSCService">
<input message="tns:searsGetOrderListForWSCService"/>
<output message="tns:searsGetOrderListForWSCServiceResponse"/>
<fault message="tns:XBeanWSException" name="XBeanWSException"/>
</operation>
</portType>
<binding name="SearsBeansPortBinding" type="tns:SearsBeans">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="searsGetOrderDetailsForWSCService">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="XBeanWSException">
<soap:fault name="XBeanWSException" use="literal"/>
</fault>
</operation>
<operation name="searsGetOrderListForWSCService">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
<fault name="XBeanWSException">
<soap:fault name="XBeanWSException" use="literal"/>
</fault>
</operation>
</binding>
<service name="SearsBeansService">
<port binding="tns:SearsBeansPortBinding" name="SearsBeansPort">
<soap:address location="REPLACE_WITH_ACTUAL_URL"/>
</port>
</service>
</definitions>
I am able to resolve this issue. I had to remove all the white spaces, comments and question marks (?) from the request (if any).
After that it was working fine. I think, due to the white spaces in request, soapUI was treating it as some kind of request element/value and was unable to convert into SOAPElement.
Hope this would be helpful for others !
Under Request Properties, set "Strip whitespaces" to true. This must be done for each new request. I didn't find a way to set true by default.
Questions marks are placeholders for parameters that must be supplied in your request.

WSDL: No element type is defined for message

I'm creating a service orchestration using Eclipse BPEL Designer plugin and i have a problem with the WSDL file that it generates automatically.
Here is the WSDL:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://ws.invocation.import" xmlns:vprop="http://docs.oasis-open.org/wsbpel/2.0/varprop" xmlns:wsdl="http://services.lolsystem.it" name="ImportOrchestration" targetNamespace="http://ws.invocation.import">
<plnk:partnerLinkType name="ImportType">
<plnk:role name="ImportRole" portType="wsdl:ImportServicePortType"/>
</plnk:partnerLinkType>
<import location="ImportModule.wsdl" namespace="http://services.italsystem.it"/>
<types>
<schema xmlns="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://ws.invocation.import">
<element name="ImportOrchestrationRequest" type="tns:ImportOrchestrationReqType">
</element>
<element name="singleEntry">
<complexType>
<sequence>
<element minOccurs="0" name="name" nillable="true" type="string"/>
<element minOccurs="0" name="content" nillable="true" type="base64Binary"/>
</sequence>
</complexType>
</element>
<element name="ImportOrchestrationResponse">
<complexType>
<sequence>
<element name="result" type="string"/>
</sequence>
</complexType>
</element>
<complexType name="ImportOrchestrationReqType">
<sequence minOccurs="1" maxOccurs="unbounded">
<element name="file" type="tns:SingleFile"></element>
</sequence>
</complexType>
<complexType name="SingleFile">
<sequence>
<element name="name" type="string"></element>
<element name="content" type="base64Binary"></element>
</sequence>
</complexType>
</schema>
</types>
<message name="ImportOrchestrationRequestMessage">
<part name="payload" type="tns:ImportOrchestrationReqType"/>
</message>
<message name="ImportOrchestrationResponseMessage">
<part element="tns:ImportOrchestrationResponse" name="payload"/>
</message>
<!-- portType implemented by the ImportOrchestration BPEL process -->
<portType name="ImportOrchestration">
<operation name="process">
<input message="tns:ImportOrchestrationRequestMessage"/>
<output message="tns:ImportOrchestrationResponseMessage"/>
</operation>
</portType>
<plnk:partnerLinkType name="ImportOrchestration">
<plnk:role name="ImportOrchestrationProvider" portType="tns:ImportOrchestration"/>
</plnk:partnerLinkType>
<binding name="ImportOrchestrationBinding" type="tns:ImportOrchestration">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="process">
<soap:operation soapAction="http://ws.invocation.import/process"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="ImportOrchestration">
<port binding="tns:ImportOrchestrationBinding" name="ImportOrchestrationPort">
<soap:address location="http://localhost:8080/ode/processes/ImportOrchestration"/>
</port>
</service>
</definitions>
Now, the problem is that Eclipse for Eclipse validator the WSDL is well formed.
I'm using Apache ODE as a BPEL engine, who is based on Axis2.
The problemi is that Axis engine give me an error when i try to deploy my BPEL proces, and it is:
"No element type is defined for message ImportOrchestrationRequestMessage"
Does someone can give me some advice to understand this error and how to correct it?
thanks in advance :)
Can you try following
<message name="ImportOrchestrationRequestMessage">
<part name="payload" element="tns:ImportOrchestrationRequest"/>
</message>
The problem is your binding is document literal, in that case the message part should be configured by using "element" rather than the "type"
HTH