部署.war在glassfish4.0上的jdeveloper中开发

时间:2013-06-25 09:58:13

标签: web-services deployment glassfish jdeveloper

我在jdeveloper 10.1.3中开发了一个.war文件。我想将它部署在作为独立服务器的glassfish4.0服务器上。

首先我将java代码编写为

package com.oi.testdemohello;

public class TestHello {
    public TestHello() {
    }

    public String sayHello(String name){
        return "Hello "+name;
    }
}

我从jdeveloper中的那个状态服务的代码创建一个J2EE1.4(JAX-RPC)和SOAP 1.1绑定Web服务。

生成的WSDL如下:

<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>

比我部署.war文件。

现在我想将此.war文件部署到glassfish 4.0服务器。但我无法做到。怎么做请建议我。

1 个答案:

答案 0 :(得分:0)

有不同的选项,例如在这个问题中列出:Best way to deploy on Glassfish V3。最简单的选择是在http://localhost:4848上使用Glassfish Admin GUI。

如果您想要在JDeveloper中集成某些内容,可以尝试GlassFish Extension for Oracle JDeveloper或阅读this articlethis question