[英]Testing a WSDL in Eclipse Web Services Explorer
I have a WSDL file for a web service which i want to test. 我有一个要测试的Web服务的WSDL文件。 Im using the Web Services Explorer in Eclipse to test the webservice. 我使用Eclipse中的Web服务资源管理器来测试Web服务。 The webservice defines a login operation,containing a loginRequest message. Web服务定义了一个登录操作,其中包含一个loginRequest消息。 The definitions are as shown below. 定义如下所示。
Login Operation 登录操作
<wsdl:operation name="login" parameterOrder="in0">
<wsdl:input message="impl:loginRequest" name="loginRequest"/>
</wsdl:operation>
loginRequest Message loginRequest消息
<wsdl:message name="loginRequest">
<wsdl:part name="in0" type="tns1:CompiereBean"/>
</wsdl:message>
CompiereBean object CompiereBean对象
<complexType name="CompiereBean">
<sequence>
<element name="loginDetails" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
<element name="productList" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
<element name="quantityList" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
<element name="tenantDetails" nillable="true" type="impl:ArrayOf_xsd_anyType"/>
</sequence>
</complexType>
ArrayOf_xsd_anyType ArrayOf_xsd_anyType
<complexType name="ArrayOf_xsd_anyType">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]"/>
</restriction>
</complexContent>
</complexType>
Now, to test the webservice, i right click on the WSDL file->Web Services->Test with Web Services Explorer. 现在,要测试Web服务,我右键单击WSDL文件-> Web服务->使用Web服务资源管理器进行测试。 I now get a form in the Actions pane,with fields for specifying loginDetails,productList,quantityList and tenantDetails. 现在,我在“操作”窗格中获得一个表单,其中包含用于指定loginDetails,productList,quantityList和tenantDetails的字段。
So, my question is since loginDetails,productList,quantityList and tenantDetails are all ArrayList objects, how to input their values ? 那么,我的问题是由于loginDetails,productList,quantityList和tenantDetails都是ArrayList对象,如何输入它们的值?
Let me show you an example and maybe it can help you. 让我向您展示一个示例,也许它可以为您提供帮助。
package mypackage;
import java.io.Serializable;
import java.util.Date;
public class Thing implements Serializable{
private static final long serialVersionUID = 4205832525113691806L;
private String name;
private Date date;
private Long longg;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public Long getLongg() {
return longg;
}
public void setLongg(Long longg) {
this.longg = longg;
}
@Override
public String toString() {
return "Thing [name=" + name + ", date=" + date + ", longg=" + longg + "]";
}
}
and the web service 和网络服务
package mypackage;
import java.util.Arrays;
import javax.ejb.Stateless;
import javax.jws.WebService;
@WebService
@Stateless
public class WS {
public void doSomething(Thing[] things){
System.out.println(Arrays.asList(things));
}
}
then if you use soapUI to generate the request for you, you'll get something like this 然后,如果您使用soapUI为您生成请求,您将获得类似以下内容的信息
and the result will be (in your server logs) 结果将是(在您的服务器日志中)
[Thing [name=aeoliam venit, date=Sun Sep 28 22:49:45 BRT 2008, longg=10]]
but, of course, you want to send an array of these things, so... 但是,当然,您想发送这些东西的数组,所以...
and voila, the result will be 和瞧,结果将是
[Thing [name=aeoliam venit, date=Sun Sep 28 22:49:45 BRT 2008, longg=10], Thing [name=aeoliam venit, date=Sun Sep 28 22:49:45 BRT 2008, longg=10]]
gotcha? 知道吗? :-) :-)
it´s incredible that we just can't find anywhere this answer. 令人难以置信的是,我们在任何地方都找不到这个答案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.