Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JAX for EJB 3.0

11 views
Skip to first unread message

������ ����������

unread,
May 4, 2009, 8:26:36 AM5/4/09
to
Hi All,

������� ��������� ���������� ������������ �� �������� � �������, �� ��� �� ��
�������.

��� ���:

package com.livinge.ejbtest;

import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;

@Stateless
@WebService (serviceName="Substructor", portName="SubstructorPort")
public class SimpleServiceBean implements ServiceBean {

@WebMethod
public int substruct(int a, int b) {
return a - b;
}
}

��� ��������� ������:

import java.net.URL;

import javax.xml.namespace.QName;
import javax.xml.ws.Service;

import com.livinge.ejbtest.ServiceBean;
import com.livinge.ejbtest.SimpleBean;
import com.livinge.ejbtest.SimpleServiceBean;


public class EJBTester {
static final String HOST = "localhost";
static final String PORT_TYPE = "SimpleServiceBean";
static final String SERVICE_NAME = "Substructor";
static final String SERVICE_ENDPOINT_ADDRESS = "http://" + HOST + ":8080/" +
SERVICE_NAME;
static final String NAME_SPACE = "http://ejbtest.livinge.com/";

public void runTest() throws Exception {
System.out.println("Try WSDL");
// Substruct substruct = new Substruct();
// SimpleServiceBean substr = substruct.;

// System.out.println(substruct.substr(50, 20));
URL wsdlLocation = new URL(SERVICE_ENDPOINT_ADDRESS + "/" + PORT_TYPE +
"?WSDL");
QName qname = new QName(NAME_SPACE, SERVICE_NAME);
Service service = Service.create(wsdlLocation, qname);
ServiceBean substr = service.getPort(SimpleServiceBean.class);
System.out.println(substr.substruct(50, 20));
}

public static void main(String[] args) {
try {
EJBTester cli = new EJBTester();
cli.runTest();

} catch (Exception e) {
e.printStackTrace();
}
}

��� ���������:
java.lang.IllegalArgumentException: com.livinge.ejbtest.SimpleServiceBean is
not an interface
at java.lang.reflect.Proxy.getProxyClass(Proxy.java:362)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
at
com.sun.xml.internal.ws.client.WSServiceDelegate.createEndpointIFBaseProxy(WSSe
rviceDelegate.java:546)
at
com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java
:292)
at
com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java
:274)
at
com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java
:302)
at
com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java
:306)
at javax.xml.ws.Service.getPort(Service.java:161)
at com.livinge.ejbtester.EJBTester.runTest(EJBTester.java:45)
at com.livinge.ejbtester.EJBTester.main(EJBTester.java:55)


��: ���� Glassfish

Sergey Bezrukov

unread,
May 7, 2009, 2:44:09 PM5/7/09
to

О©╫О©╫> ServiceBean substr = service.getPort(SimpleServiceBean.class);

ServiceBean substr = service.getPort(ServiceBean.class);

hrensgory

������ ����������

unread,
May 14, 2009, 2:41:03 AM5/14/09
to
Thu May 07 2009 23:44, Sergey Bezrukov wrote to ������ ����������:

SB> From: "Sergey Bezrukov" <ad...@playa.ru>

��>> ServiceBean substr = service.getPort(SimpleServiceBean.class);

SB> ServiceBean substr = service.getPort(ServiceBean.class);

SB> hrensgory

��������. �������� ��������� ������ �������, �� ������ ����, ��� ����� ��� ��
���������������.

����

0 new messages