Reputation: 21
I'm Having this problem:
I've developed a WS exposed in a Java EE application, this is the wsdl:types definition
<wsdl:types>
<schema elementFormDefault="qualified" targetNamespace="http://endpoint.ws.solution.client.com" xmlns="http://www.w3.org/2001/XMLSchema">
<import namespace="http://model.ws.solution.client.com"/>
<element name="invoke">
<complexType>
<sequence>
<element name="cbte_modo" type="xsd:string"/>
<element name="cuit_emisor" type="xsd:string"/>
<element name="pto_vta" type="xsd:int"/>
<element name="cbte_tipo" type="xsd:int"/>
<element name="cbte_nro" type="xsd:int"/>
<element name="cbte_fch" type="xsd:string"/>
<element name="imp_total" type="xsd:double"/>
<element name="cod_autorizacion" type="xsd:string"/>
</sequence>
</complexType>
</element>
<element name="invokeResponse">
<complexType>
<sequence>
<element name="invokeReturn" type="tns1:ComprobanteConstatarResponse"/>
</sequence>
</complexType>
</element>
</schema>
<schema elementFormDefault="qualified" targetNamespace="http://model.ws.solution.client.com" xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="ComprobanteConstatarResponse">
<sequence>
<element name="code" nillable="true" type="xsd:string"/>
<element name="fch_proceso" nillable="true" type="xsd:string"/>
<element name="msg" nillable="true" type="xsd:string"/>
<element name="resultado" nillable="true" type="xsd:string"/>
</sequence>
</complexType>
</schema>
</wsdl:types>
This Web Service exposes only one method called "Invoke", this is the method definition in it's java class:
@WebMethod
public ComprobanteConstatarResponse invoke(String cbte_modo, String cuit_emisor, Integer pto_vta, Integer cbte_tipo,
Integer cbte_nro, String cbte_fch, Double imp_total, String cod_autorizacion){
ComprobanteConstatarRequest request = new ComprobanteConstatarRequest(cbte_modo, cuit_emisor, pto_vta, cbte_tipo, cbte_nro, cbte_fch, imp_total, cod_autorizacion);
ComprobanteConstatarResponse response = this.wsConnectorFacade.validateComprobante(request);
return response;
}
As you can see, the response is a Java Class called "ComprobanteConstatarResponse".
Also, I've developed a simple C# Console Application to test calling the WS from a .NET application. So I've added the Service Reference as many tutorials said and coded the call:
static void Main(string[] args)
{
ComprobanteConstatarService webService = new ComprobanteConstatarService();
ComprobanteConstatarResponse response = new ComprobanteConstatarResponse();
response = webService.invoke("CAE","20351240181",4001,1,1223,"20140815",100.5,"CAE999999");
Console.WriteLine("Resultado: " + response.resultado + " - MSG: " + response.msg);
Console.ReadLine();
}
The call executes successfuly, but the service returns the complex type (ComprobanteConstatarResponse) with all null values. I've debbuged the code and could see that the java application receives all the parameters and build the response correctly, but when it returns to the C# application, the object has null values.
Any ideas?
Upvotes: 0
Views: 8118
Reputation: 21
Found the solution!
In visual studio, I went to ComprobanteConstatarResponse Definition (Created when the Service Reference was added. This will open a Reference.cs file) and I commented the XmlTypeAttribute containing the Namespace:
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.33440")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
//[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://model.ws.solution.client.com")]
public partial class ComprobanteConstatarResponse {
private string codeField;
private string fch_procesoField;
private string msgField;
private string resultadoField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string code {
get {
return this.codeField;
}
set {
this.codeField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string fch_proceso {
get {
return this.fch_procesoField;
}
set {
this.fch_procesoField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string msg {
get {
return this.msgField;
}
set {
this.msgField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(IsNullable=true)]
public string resultado {
get {
return this.resultadoField;
}
set {
this.resultadoField = value;
}
}
}
Then I tested again and the response values were populated.
Upvotes: 2