简体   繁体   English

Web服务SOAP集成

[英]Web service SOAP integration

Im a bit confused. 我有点困惑。 I have a WS which has different "message format" than another WS I have seen in the past. 我有一个WS,其“消息格式”与过去看到的另一个WS不同。

The vendor provided me a set of messages which they can accecpt (I have tested in SoapUI and it really works - well) 供应商向我提供了他们可以接受的一组消息(我已经在SoapUI中进行了测试,它确实有效-很好)

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:urn="urn:SAMPLE">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:CustomEnvelope>

The problem is, that in place where CustomEnvelope is used I would expect any method name (something like urn:calculateSum ). 问题是,在使用CustomEnvelope地方,我希望使用任何方法名称(例如urn:calculateSum )。

When I have tried to generate java client using Axis2, than in case od ADB databinding method I got uncompileable code. 当我尝试使用Axis2生成Java客户端时,相比于od ADB数据绑定方法,我得到了无法编译的代码。 When I have used another one, I had on my Stub object only method named (for example) calculateSum and generated message doesn't correspond to the expected schema (instead od CustomEnvelope ) there was used calculateSum . 当我使用了另一个方法后,在我的Stub对象上只有一个名为(例如) calculateSum并且生成的消息与预期的模式(而不是CustomEnvelope )不符,因此使用了calculateSum

My question is. 我的问题是。 Do you know what this strange format means? 您知道这种奇怪的格式是什么意思吗? And have you any suggestion how to integrate such strange WS? 并且您对如何集成这种奇怪的WS有任何建议吗? I think about creating the whole XML using JAXB (vendor has provided a XSD files) and sending to the WS or creating SOAPMessages using standard Java API. 我考虑使用JAXB(供应商提供了XSD文件)创建整个XML,然后发送到WS或使用标准Java API创建SOAPMessages。 But I am not sure what is there the best sollution. 但是我不确定最好的解决方案是什么。

Thanks, Ondrej 谢谢,Ondrej

I had this issue during the Axis 2 client side stub generation, which gives you uncompileable code. 在Axis 2客户端存根生成过程中遇到了这个问题,它使您无法编译代码。 Error is at the ADBDataSource class. 错误出在ADBDataSource类上。

If this is your problem then here is the solution. 如果这是您的问题,那么这里是解决方案。 What I did in my project, we are using WebSphere as the web application server and it contains a jar file (Something)ThinClient.jar in the class path of your project. 在我的项目中,我们将WebSphere用作Web应用程序服务器,并且在项目的类路径中包含一个jar文件(Something)ThinClient.jar Now this jar also contains same class called ADBDataSource but its an abstract class. 现在,此jar还包含一个称为ADBDataSource类,但它是一个抽象类。 Which conflicts with our stubs because it creates object of ADBDataSource . 这与我们的存根冲突,因为它创建了ADBDataSource对象。

I suggest try to find out that do you have a such jar or not. 我建议尝试找出您是否有这样的罐子。

Solution

Remove (Something)ThinClient.jar or one which has same class from your class path. 从类路径中删除(Something)ThinClient.jar或具有相同类的一个。

If removing (Something)ThinClient.jar creates problem, then change the approach and use Jax-Ws insteadof Axis 2, which is part of Java it self. 如果删除(Something)ThinClient.jar会造成问题,请更改方法并使用Jax-Ws代替Axis 2,它本身就是Java的一部分。 (This is what I did.) (这就是我所做的。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM