|
From: Karstaedt B. <Bas...@ha...> - 2010-06-16 18:09:32
|
Hello!
I am trying almost the same - getting some data from BiMserver via SOAP using C# .NET.
First thing to do: Use wsdl.exe which comes with Visual Studio to generate C# classes from the WSDL.
Example call:
>> wsdl http://localhost:8082/bimserver/services/soap?wsdl /language:CS /out:D:/BiMserver/WSDL (use the VS shell!)
Now you can try to call the Bimserver:
<C#-Code-Example>
ServiceInterface remoteService = new ServiceInterface();
String username = "admin";
String password = "admin";
Boolean connected = false;
try
{
remoteService.ping();
connected = true;
}
catch (Exception ex)
{
Console.WriteLine("Error connecting to " + remoteService.Url);
Console.WriteLine(ex.Message);
}
if (connected)
{
token token = remoteService.login(username, password);
if (token == null)
{
Console.WriteLine("Error: cannot log-in!");
}
else
{
Console.WriteLine("Token String is {0}", token.tokenString);
}
// do stuff
}
</C#-Code-Example>
But you'll get some confusing exception-messages:
<message>
Der vom Client gefundene Anforderungsinhaltstyp ist 'multipart/related; type="ap (translated: "Client found response content type of ‘multipart/related’, but expected ‘text/xml’")
plication/xop+xml"; boundary="uuid:960eae55-53cd-41d4-b979-ab3d10496970"; start=
"<roo...@cx...>"; start-info="text/xml"', erwartet wurde 'text/xm
l'.
Fehler bei der Anforderung mit folgender Fehlermeldung: (Request-Error with the following message:)
--
--uuid:960eae55-53cd-41d4-b979-ab3d10496970
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
Content-Transfer-Encoding: binary
Content-ID: <roo...@cx...>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body
><ns1:pingResponse xmlns:ns1="http://shared.bimserver.org/"></ns1:pingResponse><
/soap:Body></soap:Envelope>
--uuid:960eae55-53cd-41d4-b979-ab3d10496970--
--.
</message>
One can see that there is a "ping" answere from the bimserver in the exception-message. But the .NET framework simply dislikes it...
There is one workaround that works for me - see http://coding.baneworld.nl/2009/02/client-found-response-content-type-of-multipartrelated-but-expected-textxml/ for details! I googled a lot and found no other solution for this problem!
Regards, bastian
________________________________________
Von: Uroš Kolarič [uro...@gm...]
Gesendet: Montag, 7. Juni 2010 22:50
An: Bim...@li...
Betreff: [Bimserver-devel] Using SOAP from BIMserver in Visual Studio
Hi, you are doing a great job with BIMserver.
I am new to IFC and BIMserver and I have two questions about it:
* Do you have any examples of using SOAP in Visual Studio as web service?
If you use web service that was created with ASP .NET than you have no problem with SOAP.
But when I use soap from BIMserver (http://localhost:8081/bimserver/services/soap?wsdl), all I get is definition off implemented methods. There is no constructor, that creates connection with soap service.
Of course I can use C# class HttpWebRequest and get data manually.
* Can I combine two queries?
Like if I would want IfcWallStandardCase and IfcBuilding in one .ifc. Is that possible? As far as know I can query only one class.
Have a nice day,
Uroš Kolarič
uro...@gm...<mailto:uro...@gm...>
|