OK, onda ovako:
servis cije metode pozivam je na JRun-u i naravno, napisan u Javi.
Servis nije kod mene vec kod klijenta.... nemaju WSDL i iz VS-a ne mogu se tek tako
nakaciti na njihov servis da bi VS jednostavno generisao sav taj potrebni kod (WSDL a onda i refference.cs...).
Zato sam od vlasnika servisa trazio da mi posalju Java kod klasa koji se koriste kao input ili output parametri
u komunikaciji.
Nakon sto su poslali, a znao sam potpise metoda koje treba zvati, znaci sta vracaju i primaju od parametara,
napravio sam sebi testni servis u Javi koji implementira iste metoda (doduse bez logike u njima, jer mi je potrebno
samo da ih poziva zasad) i deployao ga na tomcat. Iz VS dodao WEB referrence i sve je ok, generisao WSDL i referrence i to radi divno.
Medjutim, nakon sto sam se nakacio na pravi servis nastao je problem deserijalizacije o kom sam govorio.
Evo koda:
Code:
// kod java Methoda getNextUpdate koji je eksportovvan u Java servisu i treba ga pozivati iz klijenta (postavicu samo potpis jer je tijelo ogromno):
public Vector getNextUpdate(Ticket inticket, String systemid) {
...
...
}
// kod istog tog metoda koji je generisao VS na klijentskoj strani:
/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace = "urn:SesamSimulatorService", ResponseNamespace = "urn:SesamSimulatorService", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return: System.Xml.Serialization.XmlElementAttribute("return", Form = System.Xml.Schema.XmlSchemaForm.Unqualified)]
public object[] getNextUpdate([System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] Ticket arg0, [System.Xml.Serialization.XmlElementAttribute(Form = System.Xml.Schema.XmlSchemaForm.Unqualified)] string arg1)
{
object[] results = this.Invoke("getNextUpdate", new object[] {
arg0,
arg1});
return ((object[])(results[0]));
}
Greska koju dobijam kad pokrenem klijenta i pozovem getNextUpdate method:
Code:
getNextUpdate Error msg: No Deserializer found to deserialize a ':arg0' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.
Kod spornog parametra, tj prvog argumenta u funkciji getNextUpdate:
Code:
// originalni Java kod:
public class Ticket
{
private String bestallare;
private String loginmetod;
private String klientipnr;
private String anropipnr;
private String anropmetod;
private String tid;
private String ovrigt;
// IZOSTAVLJEN KOD METODA I KONSTRUKTORA
}
// kod koji je generisao VS:
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.42")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:SesamSimulatorService")]
public partial class Ticket {
private string anropipnrField;
private string anropmetodField;
private string bestallareField;
private string klientipnrField;
private string loginmetodField;
private string ovrigtField;
private string tidField;
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string anropipnr {
get {
return this.anropipnrField;
}
set {
this.anropipnrField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string anropmetod {
get {
return this.anropmetodField;
}
set {
this.anropmetodField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string bestallare {
get {
return this.bestallareField;
}
set {
this.bestallareField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string klientipnr {
get {
return this.klientipnrField;
}
set {
this.klientipnrField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string loginmetod {
get {
return this.loginmetodField;
}
set {
this.loginmetodField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string ovrigt {
get {
return this.ovrigtField;
}
set {
this.ovrigtField = value;
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
public string tid {
get {
return this.tidField;
}
set {
this.tidField = value;
}
}
}
Sta jos, koristio sam HTTP/HTTPS analyzer da skontam sta saljem i sta vracam i dobio:
REQUEST:
Code:
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<getNextUpdate xmlns="urn:SesamSimulatorService">
<arg0 xmlns="">
<bestallare>co</bestallare>
<loginmetod> </loginmetod>
<klientipnr>xxx.xxx.xxx.xxx</klientipnr>
<anropipnr>xxx.xxx.xxx.xxx</anropipnr>
<anropmetod> </anropmetod>
<tid>2006-12-15 8:31:28</tid>
<ovrigt> </ovrigt>
</arg0>
<arg1 xmlns="">co</arg1>
</getNextUpdate>
</soap:Body>
</soap:Envelope>
a odgovor je ocekivani:
Code:
HTTP/1.0 500 Internal Server Error
Date: Fri, 15 Dec 2006 07:31:28 GMT
Server: Apache/2.0.52 (Unix) mod_ssl/2.0.52 OpenSSL/0.9.7d
Set-Cookie: JSESSIONID=d630af8145d$16$A3$0;path=/
Content-Length: 553
Connection: close
Content-Type: text/xml; charset=utf-8
<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>No Deserializer found to deserialize a ':arg0' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.</faultstring>
<faultactor>/xml-soap-sesam-extern/servlet/rpcrouter</faultactor>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
eto, mislim da je dosta informacija :) a pomoc zaista potrebna ;)