错误请求错误:400服务方法调用?

时间:2013-08-12 10:13:08

标签: c# web-services reporting-services ssrs-2008 reportingservices-2005

您好我是SSRS报告中的“SSRS”和Web服务的新手。我有一个生成条形码的Web服务。我希望条形码显示在报告中,所以我从ssrs调用Web服务方法。

方法是

[OperationContract]
Image BarcodeTextToImage(string value);

我正在使用Web服务URL从表达式上的ssrs调用方法到图像控件,

=Parameters!BarcodeURL.Value +"?value=" + CStr(Parameters!JobNumberFilter.Value)

BarcodeURL设置为

 http://localhost/barcode/DataMatrix.svc/BarcodeTextToImage

但我没有得到任何输出并得到两个警告,

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.

现在我尝试更改Web服务的配置文件,将其更改为webHttpBinding仍然是同样的问题。任何链接和答案都会很棒。

1 个答案:

答案 0 :(得分:1)

一段时间后我遇到了同样的问题,所以我找到了解决这个问题的方法,希望这对你也有用。

1)首先,我创建了带有创建的Web服务的服务引用的Web应用程序,假设Barcode39是服务,因此添加对Web应用程序的引用。 2)然后使用服务客户端编写代码并调用该方法通过传递请求变量值在该代码中创建条形码图像 3)现在将该页面的链接作为图像表达式的URL,并将图像类型设置为“EXTERNAL”,并将值作为请求变量传递给URL

 "http:\\localhost:2310\BarcodeImage.aspx?data=" +(Parameters!YourParamtere.Value)

有一件事而不是从服务返回Image尝试使用stream.ToArray()方法返回字节数组,这是最好的做法。让我知道是否有任何问题。