Problem mit Webservice per WDSL/SOAP/Comserver
- From: Thorsten <thermosoft2000@xxxxxxxxxxxxxx>
- Date: Sun, 05 Aug 2007 12:27:17 -0700
Dringender Hilferuf an Alle,
Was mache ich falsch oder was muß ich noch machen damit die Bilder in
einem Imageelement
platziert in einem Gridview angezeigt werden.
Es sollen Daten und Bildinformationen über einem Webservice in einem
Internetdienst zur Verfügung gestellt werden. Die Daten stehen durch
eine andere Applikation in Foxpro
Tabellen zur Verfügung. In den Daten gibt es ein Feld mit den Namen
von Bildern zu den Informationen. Die Bilder liegen in einem separaten
Verzeichnis vor. Bilder und Tabellen sind aus Sicherheitsgründen
zusätzlich verschlüsselt.
Ich habe einen Webdienst mit den Methoden GetTable("Mein SQL Befehl")
und GetBild("Mein Bildname") erstellt. Durch eine ASP.Net/VB Seite
wird eine Anfrage mit Übergabeparameter über SOAP/WSDL Dienst
gestellt. Die Rückgabe erfolgt als String. Die Funktion GetTable()
liefert XML-Daten und funktioniert einwandfrei.
[Abfrage.aspx.vb]
.......
Dim lcSQL As String
lcSQL = "Select platten.* from platten where platten.nsicke=2 and
platten.fp1=1"
Dim DatenHolen As New localhost.DataService()
Dim lcxml As String = DatenHolen.GetTable(lcSQL)
Dim utf8 As Encoding = Encoding.UTF8
Dim lccodepage As Encoding = Encoding.Unicode
' Convert the string into a byte[].
Dim unicodeBytes As Byte() = lccodepage.GetBytes(lcxml)
' Perform the conversion from one encoding to the other.
Dim lcxmlbytes As Byte() = Encoding.Convert(lccodepage, utf8,
unicodeBytes)
Dim lcxmlbytesstream As New MemoryStream(lcxmlbytes, True)
Dim stream As New StreamReader(lcxmlbytesstream)
Dim oDaten As New System.Data.DataSet()
oDaten.ReadXml(stream)
GridView1.DataSource = oDaten
GridView1.DataBind()
...........
Das Problem liegt bei den Bildern, dieser String wird irgendwie
abgehackt und ergibt dann logischerweise nicht Gutes. Der Com-Server
scheint alles als BSTR String zu behandeln.
[Bildholen.aspx.vb]
.......
Dim lcBild As String = "00002674"
' WSDL Service 1.1 compliant
Dim DatenHolen As New wsdltest.DataService()
Dim lcdaten As String = DatenHolen.GetBild(lcBild)
' nur Test
Response.Write(DatenHolen.GetBild(lcBild).GetType().ToString())
' Weiterverarbeitung, Bild soll in einem Imageelement
' platziert in einem Gridview angezeigt werden
' Wie?
Ausführliche Fehlermeldung:
http://www.thermosoft2000.de/download1/Kompilierungsfehler.htm
http://www.thermosoft2000.de/download1/DataService.WSDL
In VFP COM-Server erstellt als WSDLTEST. DLLerstellt und ASP.NET als
Webverweis hinzugefügt.
[VFP-Code Auszug aus der Funktion GetBild()]
PROCEDURE GetBild(tcBild as String ) As String
LOCAL lcBild, lcDLL, lcinit, lctext, cmyfile, lcDLL, lcBild1,
HookModule, Result
lctext="Password"
lcDLL="c:\visualtherm\XiCrCore.dll"
*Declare Cryptor
DECLARE INTEGER CRYIni_InitializeEx IN (lcDLL) INTEGER Mode, INTEGER
Module, STRING Exclusions
DECLARE INTEGER CRYIni_UnInitialize IN (lcDLL)
DECLARE INTEGER GetModuleHandle in win32api String Modulename
........
........
IF VARTYPE(tcBild)="C"
lcBild=tcbild
IF !EMPTY(lcbild)
lcbild=cpath1+lcbild+".JPG"
crypt_register(lcbild, lctext, 0, 0)
Local gnFileHandle,nSize,cString
gnFileHandle = FOPEN(lcbild)
nSize = FSEEK(gnFileHandle, 0, 2) && Move pointer to EOF
IF nSize > 0
= FSEEK(gnFileHandle, 0, 0) && Move pointer to BOF
lcbild1=FREAD(gnFileHandle, nSize)
= FCLOSE(gnFileHandle) && Close the file
ELSE
lcbild1=""
ENDIF
CRYIni_UnInitialize ()
*-- zum Test ob Bild wirklich erzeugt werden kann HuRa es geht
STRTOFILE(lcbild1,"c:\test.jpg")
RETURN lcbild1
ENDPROC
[WSDLTEST.TLB]
// Generated .IDL/C++ pseudo source equivalent of Win32 type library ..
\wsdltest.dll
[
uuid({59B6B110-921E-40CD-91E4-B8BF257D1BB4}),
version(1.0),
helpstring("wsdltest Type Library")
]
library wsdltest
{
// Forward references and typedefs
dispinterface Idataservice;
[
uuid({0D1E01A7-0FE6-476C-AE9B-DAC46FBA7329}),
helpstring("wsdltest.DataService")
]
dispinterface Idataservice
{
properties:
methods:
[id(0), restricted] void QueryInterface(
[in] GUID* riid,
[out] void** ppvObj);
[id(1), restricted] unsigned long AddRef();
[id(2), restricted] unsigned long Release();
[id(3), restricted] void GetTypeInfoCount([out] unsigned
int* pctinfo);
[id(4), restricted] void GetTypeInfo(
[in] unsigned int itinfo,
[in] unsigned long lcid,
[out] void** pptinfo);
[id(5), restricted] void GetIDsOfNames(
[in] GUID* riid,
[in] char** rgszNames,
[in] unsigned int cNames,
[in] unsigned long lcid,
[out] long* rgdispid);
[id(6), restricted] void Invoke(
[in] long dispidMember,
[in] GUID* riid,
[in] unsigned long lcid,
[in] unsigned short wFlags,
[in] DISPPARAMS* pdispparams,
[out] VARIANT* pvarResult,
[out] EXCEPINFO* pexcepinfo,
[out] unsigned int* puArgErr);
[id(7)] BSTR GetTable([in] BSTR tcSQL);
[id(8)] BSTR GetBild([in] BSTR tcBild);
};
[
uuid({E6EBA38E-DF17-41B0-BB7F-B33B62665FDB}),
helpstring("wsdltest.DataService")
]
coclass DataService
{
[default] dispinterface Idataservice;
};
};
In VFP einen Test des Webservices ergibt folgende Zeichen ,,ÿØÿà"
[VFP-Code]
LOCAL loDS AS "XML Web Service"
loDS = CREATEOBJECT("MSSOAP.SoapClient30")
loDS.MSSoapInit("http://localhost/DataService/
DataService.WSDL","DataService","DataServiceSoapPort")
ACTIVATE SCREEN
cdaten=lods.getbild("00002674")
? cdaten
release loDS
.
- Follow-Ups:
- Re: Problem mit Webservice per WDSL/SOAP/Comserver
- From: Stefan Falz [MVP]
- Re: Problem mit Webservice per WDSL/SOAP/Comserver
- Prev by Date: Re: VS 2005 verwendet falsche AJAX Versionen
- Next by Date: EventLogPermission für Webservice
- Previous by thread: Re: VS 2005 verwendet falsche AJAX Versionen
- Next by thread: Re: Problem mit Webservice per WDSL/SOAP/Comserver
- Index(es):
Relevant Pages
|