|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Need help in finding error in SOAP web service callsongs. The URL of the wsdl is: http://lyricwiki.org/server.php?wsdl Some of the calls work with no problem but there are several which I have a problem with: The one I will use to illustrate the problem is a getArtist call. The generated stub has a signature of : Public Function getArtist(ByRef artist As String) As String() Member of SongLyrics.org.lyricwiki.LyricWiki The code I am using to get the error is: Try result = songSearch.getArtist(artist) Catch ex As Exception End Try The message in the exception is: {"There is an error in XML document (1, 533)."} System.InvalidOperationException: {"There is an error in XML document (1, 533)."} Data: {System.Collections.ListDictionaryInternal} HelpLink: Nothing InnerException: {"Cannot assign object of type System.String to an object of type System.String[]."} Message: "There is an error in XML document (1, 533)." Source: "System.Xml" StackTrace: " at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) 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 SongLyrics.org.lyricwiki.LyricWiki.getArtist(String& artist) in C:\Visual Studio Projects\Brand New Music Console\SongLyrics\Web References\org.lyricwiki\Reference.vb:line 334 at New_Music_Console.SongViewUC.GetSongLyricsToolStripMenuItem_Click(Object sender, EventArgs e) in C:\Visual Studio Projects\Brand New Music Console\New Music Console\UserControls\SongViewUC.vb:line 1809" TargetSite: {System.Reflection.RuntimeMethodInfo} I have also captured the call thru Fiddler (what a great tool except that the XML view does not have a copy). Sent information: <?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:LyricWiki" xmlns:types="urn:LyricWiki/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><tns:getArtist><artist xsi:type="xsd:string">Amanda Somerville</artist></tns:getArtist></soap:Body></soap:Envelope> Recieved information: <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" 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:si="http://soapinterop.org/xsd" xmlns:tns="urn:LyricWiki"><SOAP-ENV:Body><ns1:getArtistResponse xmlns:ns1="urn:LyricWiki"><artist xsi:type="xsd:string">Amanda Somerville</artist><albums xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:AlbumData[0]"></albums></ns1:getArtistResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> I don't know much about SOAP and rely on the generated code but I hope someone can lead me to a cause. Even if the information is sent incorrectly or recieved incorrectly I could get a hold of the people who are responsible for the API and let them know. Thanks Lloyd Sheen
Show quote
Hide quote
"Lloyd Sheen" <a@b.c> wrote in message Lloyd, assuming that result is declared asnews:OIMot0p8JHA.3916@TK2MSFTNGP02.phx.gbl... > > Public Function getArtist(ByRef artist As String) As String() > Member of SongLyrics.org.lyricwiki.LyricWiki > > The code I am using to get the error is: > > Try > result = songSearch.getArtist(artist) > Catch ex As Exception > > End Try > dim result as String then your function definition looks to me like it should be Public Function getArtist(ByRef artist As String) As String The parentheses in your original says that getArtist returns an array of String. HTH, Tom Dacon Dacon Software Consulting
Show quote
Hide quote
"Tom Dacon" <tdacon@community.nospam> wrote in message Tom ,news:A90EFFD3-F872-4919-96EA-A5BB8D592E93@microsoft.com... > > "Lloyd Sheen" <a@b.c> wrote in message > news:OIMot0p8JHA.3916@TK2MSFTNGP02.phx.gbl... >> >> Public Function getArtist(ByRef artist As String) As String() >> Member of SongLyrics.org.lyricwiki.LyricWiki >> >> The code I am using to get the error is: >> >> Try >> result = songSearch.getArtist(artist) >> Catch ex As Exception >> >> End Try >> > > Lloyd, assuming that result is declared as > > dim result as String > > then your function definition looks to me like it should be > > Public Function getArtist(ByRef artist As String) As String > > The parentheses in your original says that getArtist returns an array of > String. > > HTH, > Tom Dacon > Dacon Software Consulting > > If I try to define result as String rather than String() I get a compile error. I should have shown the generated code for the function which is: '''<remarks/> <System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:LyricWiki#getArtist", RequestNamespace:="urn:LyricWiki", ResponseNamespace:="urn:LyricWiki")> _ Public Function getArtist(ByRef artist As String) As <System.Xml.Serialization.SoapElementAttribute("albums")> String() Dim results() As Object = Me.Invoke("getArtist", New Object() {artist}) artist = CType(results(1),String) Return CType(results(0),String()) End Function Thanks Lloyd Sheen
Show quote
Hide quote
"Lloyd Sheen" <a@b.c> wrote in message Looks like instead of these lines:news:%23Nf7eaq8JHA.1340@TK2MSFTNGP05.phx.gbl... > Tom , > > If I try to define result as String rather than String() I get a > compile error. I should have shown the generated code for the function > which is: > > '''<remarks/> > > <System.Web.Services.Protocols.SoapRpcMethodAttribute("urn:LyricWiki#getArtist", > RequestNamespace:="urn:LyricWiki", ResponseNamespace:="urn:LyricWiki")> _ > Public Function getArtist(ByRef artist As String) As > <System.Xml.Serialization.SoapElementAttribute("albums")> String() > Dim results() As Object = Me.Invoke("getArtist", New Object() > {artist}) > artist = CType(results(1),String) > Return CType(results(0),String()) > End Function > > Thanks > Lloyd Sheen > artist = CType(results(1),String) you just need> Return CType(results(0),String()) Return artist to return a single string instead of the array. Tom
.net 3.5 with vs 2005
Need some help from VB Programmers... How to hide base class member variable in derived class (w/o shadows)? Application Icon distributing software Alternative to strongly typed datasets serialPort receive problem Uisng ADO.Net The Entity Framework create com object and register trouble language for databases |
|||||||||||||||||||||||