Sunday, February 12, 2012

Building a report on top of a basicHttpBinding WCF Service

Hello,

I'm currenlty stuck in a situation not unlike http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1910495&SiteID=1 .

I've built a service exposed as basicHTTPBinding with WCF and am trying to create a report using this service as a datasource.

I've used a ".svc" file to host my web service as part of an existing ASP.NET application.

In my dev environment, the service is accessible as ht tp://localhost:10827/IncidentListes.svc (which gives the "how to generate a client for this service" page) while ht tp://localhost:10827/IncidentListes.svc?wsdl returns the following WSDL for the service :

"

<?xml version="1.0" encoding="utf-8" ?>

- <wsdlBig Smileefinitions name="IncidentSrv" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlnsTongue Tiedoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlnsTongue Tiedoapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://tempuri.org/" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsap="http://schemas.xmlsoap.org/ws/2004/08/addressing/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msc="http://schemas.microsoft.com/ws/2005/12/wsdl/contract" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlnsTongue Tiedoap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:wsa10="http://www.w3.org/2005/08/addressing" xmlns:wsx="http://schemas.xmlsoap.org/ws/2004/09/mex">

- <wsdl:types>

- <xsdTongue Tiedchema targetNamespace="http://tempuri.org/Imports">

<xsd:import schemaLocation="http://localhost:10827/IncidentListes.svc?xsd=xsd0" namespace="http://tempuri.org/" />

<xsd:import schemaLocation="http://localhost:10827/IncidentListes.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/" />

<xsd:import schemaLocation="http://localhost:10827/IncidentListes.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/Sncf.Dsit.Carto.Domaine.IncidentsSecurite" />

<xsd:import schemaLocation="http://localhost:10827/IncidentListes.svc?xsd=xsd3" namespace="http://schemas.datacontract.org/2004/07/Sncf.Dsit.Carto.Domaine" />

</xsdTongue Tiedchema>

</wsdl:types>

- <wsdl:message name="IIncidentSrv_ListePourUtilisateur_InputMessage">

<wsdlStick out tongueart name="parameters" element="tns:ListePourUtilisateur" />

</wsdl:message>

- <wsdl:message name="IIncidentSrv_ListePourUtilisateur_OutputMessage">

<wsdlStick out tongueart name="parameters" element="tns:ListePourUtilisateurResponse" />

</wsdl:message>

- <wsdlStick out tongueortType name="IIncidentSrv">

- <wsdlSurpriseperation name="ListePourUtilisateur">

<wsdl:input wsaw:Action="http://tempuri.org/IIncidentSrv/ListePourUtilisateur" message="tns:IIncidentSrv_ListePourUtilisateur_InputMessage" />

<wsdlSurpriseutput wsaw:Action="http://tempuri.org/IIncidentSrv/ListePourUtilisateurResponse" message="tns:IIncidentSrv_ListePourUtilisateur_OutputMessage" />

</wsdlSurpriseperation>

</wsdlStick out tongueortType>

- <wsdl:binding name="BasicHttpBinding_IIncidentSrv" type="tns:IIncidentSrv">

<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />

- <wsdlSurpriseperation name="ListePourUtilisateur">

<soapSurpriseperation soapAction="http://tempuri.org/IIncidentSrv/ListePourUtilisateur" style="document" />

- <wsdl:input>

<soap:body use="literal" />

</wsdl:input>

- <wsdlSurpriseutput>

<soap:body use="literal" />

</wsdlSurpriseutput>

</wsdlSurpriseperation>

</wsdl:binding>

- <wsdlTongue Tiedervice name="IncidentSrv">

- <wsdlStick out tongueort name="BasicHttpBinding_IIncidentSrv" binding="tns:BasicHttpBinding_IIncidentSrv">

<soap:address location="http://localhost:10827/IncidentListes.svc" />

</wsdlStick out tongueort>

</wsdlTongue Tiedervice>

</wsdlBig Smileefinitions>

"

1) Which URL should I use as the connection string in the dataset wizard ? With or without the "?wsdl" ?

2) How do I write the "<query>" block to obtain the results of the ListePourUtilisateur method as my dataset ?

Okay, this is solved now ... mainly after realizing that the "Cannot execute URL query" error dialog had a small "details" button that actually brought up some useful information. Smile

The problem was actually a namespace incoherence between the WSDL and my <Query>. Once this was fixed, it worked like a charm.

|||

Hey Renaud,

Could you tell me what the exact problem was (what did you entered for Querystring), because we're having the same problem.

Thanks alot,

Jeroen.

|||

Hi Jeroen,

For the query string we simply use the URL of our ".svc" page.

For the query itself, we use the following style :

<Query>
<SoapAction>
http://Namespace/ServiceName </SoapAction>
<Method Namespace="http://Namespace"
Name="ServiceName">
<Parameters>

<Parameter Name="name">
</Parameter>

</Parameters>
</Method>
<ElementPath IgnoreNamespaces="true">MethodNameResponse{}/MethodNameResult{}/ObjectName{Fields}</ElementPath>
</Query>

Hope this helps,

Renaud

No comments:

Post a Comment