用Netbeans向导编写了一个'webservice',运行在glassfish上。我添加了一个引用使用wsdl到我的.NET客户端,VB如果它有任何区别。VB.NET为glassfish编写的消费Web服务:SoapHeaderException
我明显不知道发生了什么,因为我遇到了一些砖墙。
问题是SoapHeaderException。
System.Web.Services.Protocols.SoapHeaderException: com/mysql/jdbc/Connection
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(
SoapClientMessage message, WebResponse response, Stream responseStream,
Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(
String methodName, Object[] parameters)
at WSClient.WSClient.localhost.DatabaseGateService.createCustomerTable(String xml)
in C:\Project\WSClient\Web References\localhost\Reference.vb:line 40
at WSClient.USAHWSClientConsumer.TestCustomer() in
C:\Project\WSClient\Client\WSConsumer.vb:line 22
Web服务本身很简单:
@WebService()
public class DatabaseGate {
private MySQLManagerImp manager;
public DatabaseGate(){
manager = new MySQLManagerImp();
}
@WebMethod(operationName = "createCustomerTable")
public void createCustomerTable(@WebParam(name = "xml") String xml) {
manager.createCustomersTable(xml);
}
}
它需要一个XML字符串,因为我不想在参数所憎恶的传递。
我试图通过简单实例Web引用消费服务:
Dim ws As localhost.DatabaseWS = New localhost.DatabaseWS
// Create the xml string
Dim qbCustomerQueryRS As String = qbQuery.GetCustomerQueryXML()
Dim processedCustomerXML As String =
customerResponseParser.GetAllCustomerDatabaseFriendlyXML(qbCustomerQueryRS)
ws.createCustomerTable(processedCustomerXML)
我试过在SOAP信封中写入字符串,但仍然收到了同样的信息。所以传递一个字符串是kaputt,因为它应该是;为什么WS知道要解析一个字符串,并且简单地实例化并从对象中调用该方法,就好像它是本地的一样,并不像我认为的那样工作。
发生了什么事?
看看?wsdl,我没有看到任何对Connection类的直接引用。我确实可以控制Web服务。我创建了一个非常简单的WS,没有外部引用,它起作用,所以你是对的。不幸的是,我不得不想知道为什么从客户的角度来看,WS所依赖的地方依赖关系是什么;它应该关心的是接收字符串是否正确?无论如何,我不知道如何添加正确的注释。交换SOAP消息时创建依赖关系的代码向导正在从我那里抽象出什么?谢谢回复。 – Danedo 2012-02-25 21:40:19