我正在使用用Java / Axis编写的第三方Web服务。我没有与WCF合作太多,所以我想通过这个来感受我的方式。我能够从wsdl生成类并使用Fiddler我能够看到对服务进行的调用,并返回响应。但在我的代码中,我的回答是空的,我不知道为什么我没有看到响应。我确实阅读了一篇关于命名空间的帖子,并尝试更新它,但没有运气。下面是生成的类,wsdl和来自Web服务的响应。自动生成的类有问题吗?为什么我的响应没有被C#代码消耗?
这是生成的类。我只包括我调用的方法,因为这个文件超过5000行,而且大部分都不会被我们使用。
[GeneratedCodeAttribute("wsdl", "4.0.30319.18020")]
[DebuggerStepThroughAttribute()]
[DesignerCategoryAttribute("code")]
[WebServiceBindingAttribute(Name = "grandeFacadeSoapBinding", Namespace = "http://localhost:8081/axis/services/grandeFacade")]
public partial class grandeFacadeService : SoapHttpClientProtocol
{
private SendOrPostCallback EnterpriseObjectsOperationCompleted;
private SendOrPostCallback EnterpriseObjecOperationCompleted;
public grandeFacadeService()
{
this.Url = "http://example.com:8081/axis/services/grandeFacade";
}
public event EnterpriseObjectsCompletedEventHandler EnterpriseObjectsCompleted;
public event EnterpriseObjecCompletedEventHandler EnterpriseObjecCompleted;
[SoapDocumentMethodAttribute("", RequestNamespace = "http://localhost:8180/grandeFacade/services/grandeFacade", ResponseNamespace = "http://localhost:8180/grandeFacade/services/grandeFacade", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[return: XmlElementAttribute("EnterpriseObjectsReturn")]
public WebServiceResp EnterpriseObjects([Serialization.XmlElementAttribute("EnterpriseObjValues")] EnterpriseObjValues[] EnterpriseObjValues)
{
object[] results = this.Invoke("EnterpriseObjects", new object[] { EnterpriseObjValues });
return ((WebServiceResp)(results[0]));
}
public IAsyncResult BeginEnterpriseObjects(EnterpriseObjValues[] EnterpriseObjValues, AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("EnterpriseObjects", new object[] { EnterpriseObjValues}, callback, asyncState);
}
public WebServiceResp EndEnterpriseObjects(IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((WebServiceResp)(results[0]));
}
public void EnterpriseObjectsAsync(EnterpriseObjValues[] EnterpriseObjValues)
{
this.EnterpriseObjectsAsync(EnterpriseObjValues, null);
}
public void EnterpriseObjectsAsync(EnterpriseObjValues[] EnterpriseObjValues, object userState)
{
if ((this.EnterpriseObjectsOperationCompleted == null))
{
this.EnterpriseObjectsOperationCompleted = new SendOrPostCallback(this.OnEnterpriseObjectsOperationCompleted);
}
this.InvokeAsync("EnterpriseObjects", new object[] { EnterpriseObjValues}, this.EnterpriseObjectsOperationCompleted, userState);
}
private void OnEnterpriseObjectsOperationCompleted(object arg)
{
if ((this.EnterpriseObjectsCompleted != null))
{
InvokeCompletedEventArgs invokeArgs = ((InvokeCompletedEventArgs)(arg));
this.EnterpriseObjectsCompleted(this, new EnterpriseObjectsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
[SoapDocumentMethodAttribute("", RequestNamespace = "http://localhost:8180/grandeFacade/services/grandeFacade", ResponseNamespace = "http://localhost:8180/grandeFacade/services/grandeFacade", Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
[return: XmlElementAttribute("EnterpriseObjecReturn")]
public wsResponse EnterpriseObjec(EnterpriseObjValues EnterpriseObjValues)
{
object[] results = this.Invoke("EnterpriseObjec", new object[] { EnterpriseObjValues });
return ((wsResponse)(results[0]));
}
public IAsyncResult BeginEnterpriseObjec(EnterpriseObjValues EnterpriseObjValues, AsyncCallback callback, object asyncState)
{
return this.BeginInvoke("EnterpriseObjec", new object[] { EnterpriseObjValues}, callback, asyncState);
}
public wsResponse EndEnterpriseObjec(IAsyncResult asyncResult)
{
object[] results = this.EndInvoke(asyncResult);
return ((wsResponse)(results[0]));
}
public void EnterpriseObjecAsync(EnterpriseObjValues EnterpriseObjValues)
{
this.EnterpriseObjecAsync(EnterpriseObjValues, null);
}
public void EnterpriseObjecAsync(EnterpriseObjValues EnterpriseObjValues, object userState)
{
if ((this.EnterpriseObjecOperationCompleted == null))
{
this.EnterpriseObjecOperationCompleted = new SendOrPostCallback(this.OnEnterpriseObjecOperationCompleted);
}
this.InvokeAsync("EnterpriseObjec", new object[] { EnterpriseObjValues}, this.EnterpriseObjecOperationCompleted, userState);
}
private void OnEnterpriseObjecOperationCompleted(object arg)
{
if ((this.EnterpriseObjecCompleted != null))
{
InvokeCompletedEventArgs invokeArgs = ((InvokeCompletedEventArgs)(arg));
this.EnterpriseObjecCompleted(this, new EnterpriseObjecCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
}
这是WSDL的URL。不确定这是否可以在我们的网络外访问。
http://sdrsafposent1d:8081/axis/services/grandeFacade?wsdl
这是Fiddler捕获的回应。我的另一个问题是响应,我看到有一个Java Exception和一些丑陋的乱码。这可能导致响应没有被消耗的问题吗?
2000
<?xml version="1.0" encoding="UTF-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<EnterpriseObjectsResponse xmlns="http://localhost:8180/grandeFacade/services/grandeFacade">
<EnterpriseObjectsReturn>
<wsResponse>
<action>INSERT</action>
<documentID>1000</documentID>
<errorMsg></errorMsg>
<objectName>enca_orden_compra</objectName>
<stackTrace></stackTrace>
<status>Not processed</status>
<transactionID>1</transactionID>
</wsResponse>
<wsResponse>
<action>INSERT</action>
<documentID>1000</documentID>
<errorMsg></errorMsg>
<objectName>det_orden_compra</objectName>
<stackTrace></stackTrace>
<status>Not processed</status>
<transactionID>1</transactionID>
</wsResponse>
<wsResponse>
<action>update</action>
<documentID>1000</documentID>
<errorMsg></errorMsg>
<objectName>enca_orden_compra</objectName>
<stackTrace></stackTrace>
<status>Not processed</status>
<transactionID>1</transactionID>
</wsResponse>
<wsResponse>
<action>update</action>
<documentID>1000</documentID>
<errorMsg></errorMsg>
<objectName>enca_orden_compra</objectName>
<stackTrace></stackTrace>
<status>Not processed</status>
<transactionID>1</transactionID>
</wsResponse>
<wsResponse>
<action>update</action>
<documentID>1000</documentID>
<errorMsg></errorMsg>
<objectName>enca_orden_compra</objectName>
<stackTrace></stackTrace>
<status>Not processed</status>
<transactionID>1</transactionID>
</wsResponse>
<wsResponse>
<action>Informative</action>
<documentID>Footer</documentID>
<errorMsg>NULL</errorMsg>
<objectName></objectName>
<stackTrace>none
*******************************************************************************
* Object Name: det_orden_compra
* Field Name: Unidades_ordenadas
* Field Value: 1
* Process Step: Getting primary key
* Possible Error: Incorrect field name or value data from the key
*******************************************************************************
java.lang.NullPointerException</stackTrace>
<status>error</status>
<transactionID>
***********************************************************************************************
<EnterpriseObjsValues>
<EnterpriseObjValues>
<objectName>enca_orden_compra</objectName>
<action>INSERT</action>
<documentID>1000</documentID>
<transactionID>1</transactionID>
<source>ORACLE</source>
<whereClasue>sucursal = XYZ AND orden = 34567</whereClasue>
<objectDetail>
<item>
<fieldName>external_id</fieldName>
<fieldValue>345888</fieldValue>
</item>
<item>
<fieldName>sucursal</fieldName>
<fieldValue>XYZ</fieldValue>
</item>
<item>
<fieldName>orden</fieldName>
<fieldValue>34567</fieldValue>
</item>
<item>
<fieldName>proveedor</fieldName>
<fieldValue>45454</fieldValue>
</item>
<item>
<fieldName>comprador</fieldName>
<fieldValue>1001</fieldValue>
</item>
<item>
<fieldName>tipo_distribucion</fieldName>
<fieldValue>DD</fieldValue>
</item>
<item>
<fieldName>order_origin</fieldName>
<fieldValue>C</fieldValue>
</item>
<item>
<fieldName>document_status</fieldName>
<fieldValue>5</fieldValue>
</item>
<item>
<fieldName>fecha_orden</fieldName>
<fieldValue>3/13/2015 12:53:54 PM</fieldValue>
</item>
<item>
<fieldName>fecha_entrada</fieldName>
<fieldValue>3/20/2015 12:53:54 PM</fieldValue>
</item>
<item>
<fieldName>fecha_cancelacion</fieldName>
<fieldValue>3/27/2015 12:53:54 PM</fieldValue>
</item>
</objectDetail>
</EnterpriseObjValues>
<EnterpriseObjValues>
<objectName>det_orden_compra</objectName>
<action>INSERT</action>
<documentID>1000</documentID>
<transactionID>1</transactionID>
<source>ORACLE</source>
<whereClasue>sucursal = AND orden = 34567 AND Articulo = '1'</whereClasue>
<objectDetail>
<item>
<fieldName>sucursal</fieldName>
<fieldValue></fieldValue>
</item>
<item>
<fieldName>orden</fieldName>
<fieldValue>34567</fieldValue>
</item>
<item>
<fieldName>Articulo</fieldName>
<fieldValue>1</fieldValue>
</item>
<item>
<fieldName>Unidades_ordenadas</fieldName>
<fieldValue>null</fieldValue>
</item>
<item>
<fieldName>Costo</fieldName>
<fieldValue>13-MAR-15</fieldValue>
</item>
<item>
<fieldName>confirmed_quantity</fieldName>
<fieldValue>null</fieldValue>
</item>
<item>
<fieldName>confirmation_date</fieldName>
<fieldValue>3/20/2015 12:53:54 PM</fieldValue>
</item>
<item>
<fieldName>confirmation_number</fieldName>
<fieldValue>34567</fieldValue>
</item>
<item>
<fieldName>document_status</fieldName>
<fieldValue>5</fieldValue>
</item>
<item>
<fieldName>sequence</fieldName>
<fieldValue>4567</fieldValue>
</item>
<item>
<fieldName>requisition</fieldName>
<fieldValue>1</fieldValue>
</item>
</objectDetail>
</EnterpriseObjValues>
<EnterpriseObjValues>
<objectName>enca_orden_compra</objectName>
<action>update</action>
<documentID>1000</documentID>
<transactionID>1</transactionID>
<source>ORACLE</source>
<whereClasue>sucursal = AND orden = 34567</whereClasue>
<objectDetail>
<item>
<fieldName>sucursal</fieldName>
<fieldValue></fieldValue>
</item>
<item>
<fieldName>orden</fieldName>
<fieldValue>34567</fieldValue>
</item>
<item>
<fieldName>status_proceso</fieldName>
<fieldValue>18</fieldValue>
</item>
</objectDetail>
</EnterpriseObjValues>
<EnterpriseObjValues>
<objectName>enca_orden_compra</objectName>
<action>update</action>
<documentID>1000</documentID>
<transactionID>1</transactionID>
<source>ORACLE</source>
<whereClasue>sucursal = AND orden = 34567</whereClasue>
<objectDetail>
<item>
<fieldName>sucursal</fieldName>
<fieldValue></fieldValue>
</item>
<item>
<fieldName>orden</fieldName>
<fieldValue>34567<
554
/fieldValue>
</item>
<item>
<fieldName>status_proceso</fieldName>
<fieldValue>19</fieldValue>
</item>
</objectDetail>
</EnterpriseObjValues>
<EnterpriseObjValues>
<objectName>enca_orden_compra</objectName>
<action>update</action>
<documentID>1000</documentID>
<transactionID>1</transactionID>
<source>ORACLE</source>
<whereClasue>sucursal = AND orden = 34567</whereClasue>
<objectDetail>
<item>
<fieldName>sucursal</fieldName>
<fieldValue></fieldValue>
</item>
<item>
<fieldName>orden</fieldName>
<fieldValue>34567</fieldValue>
</item>
<item>
<fieldName>status_proceso</fieldName>
<fieldValue>3</fieldValue>
</item>
</objectDetail>
</EnterpriseObjValues>
</EnterpriseObjsValues>
***********************************************************************************************
</transactionID>
</wsResponse>
</EnterpriseObjectsReturn>
</EnterpriseObjectsResponse>
</soapenv:Body>
</soapenv:Envelope>
0
以下是我正在进行调用并捕获响应的代码块。
grandeFacadeService grandeFacadeService serv = new grandeFacadeService();
WebServiceResp response = serv.EnterpriseObjects(enterpriseObjValueslist);
wsResponse[] responseArray= response.wsResponse;
答案 0 :(得分:0)
问题原来是xml本身。如果你看一下xml的一半,看起来他们的响应是解码大于和小于。