我的nusopa php服务位于链接: http://localhost/SOAP/soapWebService.php?wsdl
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://localhost/soap/samplePHPService" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://localhost/soap/samplePHPService">
<types>
<xsd:schema targetNamespace="http://localhost/soap/samplePHPService">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:schema>
</types>
<message name="wonderLocatedPlaceRequest">
<part name="name" type="xsd:string"/>
</message>
<message name="wonderLocatedPlaceResponse">
<part name="return" type="xsd:string"/>
</message>
<portType name="samplePHPServicePortType">
<operation name="wonderLocatedPlace">
<input message="tns:wonderLocatedPlaceRequest"/>
<output message="tns:wonderLocatedPlaceResponse"/>
</operation>
</portType>
<binding name="samplePHPServiceBinding" type="tns:samplePHPServicePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="wonderLocatedPlace">
<soap:operation soapAction="http://localhost/SOAP/soapWebService.php/wonderLocatedPlace" style="rpc"/>
<input>
<soap:body use="literal" namespace=""/>
</input>
<output>
<soap:body use="literal" namespace=""/>
</output>
</operation>
</binding>
<service name="samplePHPService">
<port name="samplePHPServicePort" binding="tns:samplePHPServiceBinding">
<soap:address location="http://localhost/SOAP/soapWebService.php"/>
</port>
</service>
</definitions>
我通过wsimport.exe创建java类,并且有类。
接下来我创建了客户客户:
public class Main {
public static void main(String[] args) throws MalformedURLException {
SamplePHPServicePortType stub;
//Generating stub to use the existing service
stub = new SamplePHPService().getSamplePHPServicePort();
//Calling the existing service with the stub
String place = stub.wonderLocatedPlace("Taj Mahal");
System.out.println(place);
}
}
获得例外:
Exception in thread "main" com.sun.xml.internal.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: error in msg parsing:
xml was empty, didn't parse! Please see the server log to find more detail regarding exact cause of the failure.
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:116)
at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(StubHandler.java:238)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:189)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:276)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:104)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
at com.sun.proxy.$Proxy29.wonderLocatedPlace(Unknown Source)
at com.company.Main.main(Main.java:22)
有效性xml是成功的,但还有其他问题..它是什么?