我正在运行 Tomcat 5.5 + Axis2 1.5.5 + 2 个 servlet。
我的一个 servlet 是一个自定义 servlet,它也运行 axis2。
我有 WEB-INF 及其下的所有子目录(conf、lib、services 和modules)。
现在,我的类之一是 EntityWebService,它应该作为 WS 公开。
所以我制作了这个 services.xml 文件:
<service name="EntityWebService" scope="application">
<description>
service web sur les entites
</description>
<messageReceivers>
<messageReceiver
mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
<messageReceiver
mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>
<parameter name="ServiceClass">com.webservice.EntityWebService</parameter>
</service>
这个抛出了这个:
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">
The service cannot be found for the endpoint reference (EPR) /myServlet/services/EntityWebService/getEntityList
</soapenv:Text>
</soapenv:Reason>
我还尝试了一个更简单的文件:
<service name="EntityWebService">
<description>Web Service</description>
<parameter name="ServiceClass" locked="xsd:false">com.webservice.EntityWebService
</parameter>
<operation name="getEntityList">
<messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
</operation>
<operation name="getEntityDescription">
<messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
</operation>
<operation name="searchInstanceEntity">
<messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
</operation>
<operation name="entityWriter">
<messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
</operation>
</service>
这个也抛出了同样的问题。
这两个 xml 都应该(至少是我从所有网络内容中理解的)公开这些方法:
- public OMElement getEntityDescription(StringEntityName)
- public OMElement getEntityList()
- public OMElement searchInstanceEntity(String login, String password,
字符串角色、字符串实体名称、字符串属性、字符串条件)
- public OMElementEntityWriter(字符串登录、字符串密码、字符串
角色、字符串实体名称、字符串操作类型、字符串属性)
理想情况下,我想直接从我的 URL 调用这些方法,例如:
http://localhost:8080/myServlet/services/EntityWebService/searchInstanceEntity?login=jmm&password=jmm&role=AdminRol&entityName=beans.Personnel.Salarie&property=all&criteria=null< /a>
我已经制作了这样的 EntityWebService 类,以便它可以按照 WS 标准运行:
package com.webservice;
[imports]
@WebService
public class EntityWebService extends AbstractWebService
{
@WebMethod
public OMElement getEntityList(OMElement e) throws RemoteException
{
[...]
}
@WebMethod
public OMElement getEntityDescription(OMElement omEntityParam) throws RemoteException
{
[...]
}
@WebMethod
public OMElement searchInstanceEntity(OMElement omParam) throws RemoteException
{
[...]
}
@WebMethod
public OMElement entityWriter(OMElement omParam) throws RemoteException
{
[...]
}
@Override
public String getServiceName()
{
return "EntityWebService";
}
}
现在是我的问题。如何在启用 URL 编码参数的情况下公开我的 4 个方法?
我的配置不起作用,好像我遗漏了一些东西。我曾设法使它们可调用但无需输入参数。
我从最新的 1.5.5 版本中检索了 Axis2.xml,但没有更好的结果。我们有一个旧的配置,可以使用 RPC 消息传递和 XML,但我想摆脱 AAR 容器。我有一个朋友,他有我上面向您展示的 XMLInOut 消息服务.xml,它对他有用。他刚刚在 services 下创建了一个目录,如下所示:
/myServlet/services/EntityWebService/META-INF/services.xml
请帮助我,我的工作需要这个。谢谢
I have Tomcat 5.5 + Axis2 1.5.5 + 2 servlets running.
One of my servlet is a custom servlet that runs axis2 too.
I have WEB-INF and all subdirectories under it (conf, lib, services and modules).
Now, one of my class is EntityWebService which is the one supposed to be exposed as a WS.
So i have made this services.xml file :
<service name="EntityWebService" scope="application">
<description>
service web sur les entites
</description>
<messageReceivers>
<messageReceiver
mep="http://www.w3.org/2004/08/wsdl/in-only"
class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/>
<messageReceiver
mep="http://www.w3.org/2004/08/wsdl/in-out"
class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/>
</messageReceivers>
<parameter name="ServiceClass">com.webservice.EntityWebService</parameter>
</service>
This one throws this :
<soapenv:Reason>
<soapenv:Text xml:lang="en-US">
The service cannot be found for the endpoint reference (EPR) /myServlet/services/EntityWebService/getEntityList
</soapenv:Text>
</soapenv:Reason>
I had also tried a simpler one :
<service name="EntityWebService">
<description>Web Service</description>
<parameter name="ServiceClass" locked="xsd:false">com.webservice.EntityWebService
</parameter>
<operation name="getEntityList">
<messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
</operation>
<operation name="getEntityDescription">
<messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
</operation>
<operation name="searchInstanceEntity">
<messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
</operation>
<operation name="entityWriter">
<messageReceiver
class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver" />
</operation>
</service>
This one throws the same too.
Both of these xml are supposed (at least it's what i understood from all web stuff) to expose these methods :
- public OMElement getEntityDescription(String entityName)
- public OMElement getEntityList()
- public OMElement searchInstanceEntity(String login, String password,
String role, String entityName, String property, String criteria)
- public OMElement entityWriter(String login, String password, String
role,String entityName, String actionType, String property)
Ideally i want to call these methods directly from my URL like :
http://localhost:8080/myServlet/services/EntityWebService/searchInstanceEntity?login=jmm&password=jmm&role=AdminRol&entityName=beans.Personnel.Salarie&property=all&criteria=null
I have made EntityWebService class like this so it can run with WS standards :
package com.webservice;
[imports]
@WebService
public class EntityWebService extends AbstractWebService
{
@WebMethod
public OMElement getEntityList(OMElement e) throws RemoteException
{
[...]
}
@WebMethod
public OMElement getEntityDescription(OMElement omEntityParam) throws RemoteException
{
[...]
}
@WebMethod
public OMElement searchInstanceEntity(OMElement omParam) throws RemoteException
{
[...]
}
@WebMethod
public OMElement entityWriter(OMElement omParam) throws RemoteException
{
[...]
}
@Override
public String getServiceName()
{
return "EntityWebService";
}
}
Now my question. How can I expose my 4 methods with URL encoded parameter enabled?
My configuration doesn't work, seems like I'm missing something. I've managed once to make them callable but without parameters input.
I retrieved Axis2.xml from last 1.5.5 release but no better results. We had an old configuration which worked with RPC messaging and XML but i wanted to get rid of AAR containers. I have a friend who have the XMLInOut messaging services.xml i showed you above and it works for him. He just made a directory under services like this :
/myServlet/services/EntityWebService/META-INF/services.xml
Help me please, I need this for my work. thx
发布评论
评论(1)
显然,升级 Axis2 配置并使用 1.6 axis 版本解决了该问题。不知道如何以及为什么,但无论如何......
Apparently, upgrading Axis2 config and using 1.6 axis release solved the problem. dunno how and why but whatever...