我正在使用eclipse和jBoss 7.我需要连接一个Android应用程序和JBoss 7。 目前我正在尝试做一个Web服务的例子。 然后我创建了一个带有注释的EJB,...,生成WSDL文件,... 我在JBoss 7上部署了Web服务。
我的EJB中有两个方法,第一个工作得很好(它是一个简单的hello世界)。 在第二种方法中,我尝试在服务器上调用我的anothers EJB,没有错误。
但是在客户端,当我尝试调用Web服务的第二种方法时,我有错误:
调用第一种方法:Résultat您好:Hello Anthony
调用第二种方法:
Exception in thread "main" AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: java.lang.reflect.InvocationTargetException
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}hostname:UPS-NB03
java.lang.reflect.InvocationTargetException
at org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.java:222)
at org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.java:129)
at org.apache.axis.encoding.DeserializationContext.endElement(DeserializationContext.java:1087)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
at org.apache.axis.client.Call.invoke(Call.java:2767)
at org.apache.axis.client.Call.invoke(Call.java:2443)
at org.apache.axis.client.Call.invoke(Call.java:2366)
at org.apache.axis.client.Call.invoke(Call.java:1812)
at helloworld.HelloWorldSoapBindingStub.connexion(HelloWorldSoapBindingStub.java:153)
at servicelogin.Main.main(Main.java:17)
以下是我对Web服务的实现: 包helloworld; import javax.jws.WebService;
@WebService
public interface HelloRemote
{
public String echo(String input);
public int connexion(String userid,String password);
}
package helloworld;
import java.math.BigDecimal;
import java.rmi.RemoteException;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import com.upsilon.beans.login.LoginDto;
import com.upsilon.beans.login.LoginHome;
import com.upsilon.utils.resource.Server;
import com.upsilon.utils.tools.ServiceLocator;
import com.upsilon.utils.tools.YUserProfile;
@Stateless
@WebService(name = "EndpointInterface", targetNamespace = "Services", serviceName = "HelloService")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@Remote(HelloRemote.class)
public class HelloWorld implements HelloRemote
{
@WebMethod
public String echo(String input)
{
return "Hello " + input;
}
@WebMethod
public int connexion(String userid,String password) //Connexion to ejb whose return an int. If int = 1 connected to db
{
......
ejb = ((LoginHome) sl.getEjbHome("Login",LoginHome.class)).create();
loginDto = ejb.getConnectPerson(userid, password);
logonState = loginDto.getLogonState();
return logonState;
}
}
这里是客户端的实现(我从WSDL生成带有eclipse的类) 包servicelogin;
import helloworld.HelloWorldService;
import helloworld.HelloWorldServiceLocator;
import java.rmi.RemoteException;
import javax.xml.rpc.ServiceException;
public class Main {
public static void main(String[] args) throws RemoteException, ServiceException {
HelloWorldService loginServ = new HelloWorldServiceLocator();
String resultatLog = loginServ.getHelloWorld().echo("Anthony");
System.out.println("Résultat Hello : " + resultatLog);
System.out.println("Résultat login " + loginServ.getHelloWorld().connexion("565156","9594191"));
}
}
如果有人有想法? 感谢您的帮助和时间:-) 抱歉我的英语:p