Hi I am new to the "SSRS" and web services i am trying to call the web service from the SSRS report.I have one web service which generates the barcode. I want the barcode to display in the report so i am calling the web service method from the ssrs.
The method is
[OperationContract]
Image BarcodeTextToImage(string value);
I am using the web service URL to call the method from the ssrs on the expression set to the image control as,
=Parameters!BarcodeURL.Value +"?value=" + CStr(Parameters!JobNumberFilter.Value)
where is BarcodeURL is set as
http://localhost/barcode/DataMatrix.svc/BarcodeTextToImage
but i am not getting any output and getting two warnings as ,
1) [rsInvalidImageReference] The Value for the image ‘Image3’ is invalid. Details: The remote server returned an error: (400) Bad Request.
2) [rsInvalidExternalImageProperty] The value of the ImageData property for the image ‘Image3’ is “”, which is not a valid ImageData.
Now i tried changing the config file of web service to change it to webHttpBinding still same issue. Any links and answers will be great.
I have got same problem some time back so i got a work around for this problem i hope this will work for you too.
1) First i created the web app with the service reference of the created web service suppose Barcode39 is service so add the reference to the web application.
2) Then write the code behind using service client and call the method to create the barcode image in that code by passing the request variables values
3) Now give the link of that page as the URL to the image expression along with setting the image type as "EXTERNAL" and pass the values to the URL as request variables as
"http:\\localhost:2310\BarcodeImage.aspx?data=" +(Parameters!YourParamtere.Value)
And one thing instead of returning the Image from the service try returning the byte array using stream and .ToArray() method that would be the best practice.Let me know if any problem.
Related
I am using ASP.NET 4.0 and need to return a SOAP (XML) Response to a JSON variable within javascript on the page. Than I would like to be able to call the variable and it's properties as you would with any JSON variable. The Soap Web Service (.asmx) file is not on the server where I need to build the client-side (receiving the request and putting it into a JSON variable). Also, to make this more complicated, the XML Request that gets send to the Web Service needs to send a UserName and Password to be able to return the items.
The URL for the Web Service is here: http://ws.idssasp.com/members.asmx?wsdl
Figured I would create a Visual Studio Web Application Project (C#), which I was able to do and connect to the Web Service just fine, however, This needs to be on a page that javascript uses to output the items that come from the methods of the web service. So, a .aspx file would not work in this case, since it would need to output only the result of the web service response in a JSON variable within a tag (probably in the head of the page, but doesn't matter to me where). Or it could dynamically create a .JS file (which would probably be better, since it would be cached and wouldn't need to call the web service multiple times if the js file exists on my server). However, I'm not sure on what to build in Visual Studio to accomplish this? And I'm not sure on how it would be used to output it onto the page. I suppose the JSON variable could also be stored within a Members.json file on the server and could just call that to load up the json needed.
How to return a JSON array from SOAP, XML, Response... after sending a request to another server with UserName and Password in the header of the SOAP Request. There is a page here that explains the XML needed for the Request and what the response will look like: http://ws.idssasp.com/members.asmx?op=GetMemberList&pn=0
On this same page, they show you how to do it via PHP, but PHP is not available, and only have ASP.NET 4.0 available to me. Here is their PHP way of doing it:
$clientWS = new SoapClient('http://ws.idssasp.com/Members.asmx?wsdl');
$namespaceWS = 'http://ws.idssasp.com/Members.asmx';
$dmsClientU = '';
$dmsClientP = '';
$headerBodyWS = array('UserName' => $dmsClientU, 'Password' => $dmsClientP);
$headerWS = new SOAPHeader($namespaceWS, 'AuthorizeHeader', $headerBodyWS, false);
$clientWS->__setSoapHeaders(array($headerWS));
$results = $clientWS->GetMemberList();
print_r( $results );
How would I be able to do the same thing here is ASP.NET 4.0, but instead of returning the XML result, return a JSON variable that gets used within a script tag on the page?
Or maybe I am overthinking this and there is a better solution?
If you are connecting to the web service and retrieving objects without issues, you should be able to construct JSON objects out of the properties of the SOAP responses.
I suggest creating a web service in ASP.NET, converting the SOAP response to JSON in the C# server code, then using AJAX in the JavaScript of your page to retrieve the JSON from your web service. Basically, you would be creating your own specialized conversion web service for your project that sits in the middle.
Keep the credentials you need server-side for your .asmx conversion service. Whatever you do, do not put credentials in the client-side JavaScript for a web service call, even if it lets you avoid writing server-side code.
For some reference on ASP.NET web services:
http://msdn.microsoft.com/en-us/library/bb398998%28v=vs.100%29.ASPX
http://msdn.microsoft.com/en-us/library/bb763183%28v=vs.100%29.ASPX
one of my friend made a soap webservice in PHP and now i have to consume it into my winform app. I added web Service Reference , pasted the URL and it is showing method name.
The method name is Display().
Now after adding when write code on button click, it is showing following three methods:
MyWebServiceName. DisplayCompletedEventArgs
DisplayCompletedEventHandler
SiteControllerService
There is no soapClient or direct Display method ,any one know , what am I doing wrong?
Check the WSDLyou must have in the VS project. You will find the service name:
Ex:
<wsdl:service name="SiteControllerService">
So you must type:
MyWebServiceName.SiteControllerService SOAPclient = new MyWebServiceName.SiteControllerService();
SOAPClient.Display();
Visual Strudio create a namespace to encapsulate all classes generated to work with the web service. In that namespace you will find the soap proxy client, events and events handler and any data transfer object needed to pass parameters to proxy client or to recive the response.
I'm working on some application which is in ASP.Net 3.5 in which I've to embed a new feature called Instant Messaging/ Push Notification.
For this, I've used WCF to send data to client.
But the issue is, when WCF sends data to client at that time I'm unable to use it at client in asp page like I can't display it in web page or unable to update my page by using the data send by WCF.
I've tried
Response.Write(sendData); //sendData is the data which is send by WCF
just to write data on page,
But, Its also throwing an exception:
"Response is not available in this context."
So, please let me know how can I use sendData in my application.
You are trying to use HttpContext.Current.Response in a code where there is no current response.
If this is used in an HTTPHandler, you need to use the Context object passed through the ProcessRequest method in the IHTTPHandler interface.
Further, you can see here
I am new to web service. I want to send the XML file to the web method without adding reference to webservice class, using Post method but every time i am getting Error 500
can any body help me?????
If you're using ASMX (.Net 2.0) services then you can change the webservice URL at runtime.
I don't find any other reason for not adding a Web service reference.
Also for 500 Internal Server Error check whether you can access the web service.
This should solve your issue.
I have a page fetching HTML content from a WCF REST service via AJAX. I started seeing errors on IE to the effect that "This page is accessing information that is not under its control...". For some content, the WCF service will, instead of returning the content directly, return instead an object or iframe tag pointing back to itself with different parameters. The WCF service sees a different URL than was requested, and the discrepancy causes the "security" error as IE thinks it's loading content from a different domain.
So, for example, the XHR request asked for
"http://localhost/Services/Content.svc?id=123..."
or even
"http://mymachine/Services/Content.svc?id=123..."
As soon as the request reaches the WCF service, however, the URL is turned into:
"http://mymachine.mydomain.com/Services/Content.svc?id=123..."
How can I get the originally requested URL within the WCF service? I've inspected theWebOperationContext.Current.IncomingRequest.UriTemplateMatch properties to no avail, there is no remaining trace of "localhost". I've also looked at the following posts and still cannot find the original URL:
What is the WCF equivalent of HttpContext.Current.Request.RawUrl?
http://jstawski.com/archive/2008/05/01/wcf-wsdl-location-address-with-https.aspx
Is there any way to get to it?
Be aware that any service running in IIS will use the host name specified in the IIS bindings. In order to change this, you will need to change the settings in IIS.