Showing posts with label response. Show all posts
Showing posts with label response. Show all posts

Monday, March 26, 2012

call web services using bridging (ajax beta 2)

I have several web service methods(implemented in .net 1.1) to call, in a different domain. The response I get when callin any methods from this web service is the page I see at the URL where .asmx is located. The .asbx is:

<bridge namespace="Support" className="OLOS" ><proxy type="Microsoft.Web.Preview.Services.BridgeRestProxy" serviceUrl="http://suppsite/SuppServices/OLOS.asmx" /><method name="getGeodisInfo" ><input><parameter name="OrderInformation" /><parameter name="BUID" /></input></method><method name="getExpeditorsInfo" ><input><parameter name="OrderInformation"/><parameter name="BUID" /></input></method></bridge>

And the .aspx file:

.............. <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="~/OLOS.asbx" /> </Services> </asp:ScriptManager>..............Support.OLOS.getGeodisInfo({ 'OrderInformation' : txtSearchText.value, 'BUID' : ' ' }, OnSucessgetGeodisInfo, OnError, "OLOS Search");.............. function OnSucessgetGeodisInfo(result) { if (result != null) { var resultText = result; document.getElementById('res1').innerHTML = resultText; } }
 
In the innerHTML of the DIV where I show results I get the content from the page located athttp://suppsite/SuppServices/OLOS.asmx
I do not see the actual call to the web method being done. Fiddler shows a call tohttp://suppsite/CareServiceCall/OLOS.asbx/js/getGeodisInfo but the response... does not contain what the method should return...
Any ideas?
Thanks

So I'm guessing your service url for the Asmx endpoint should behttp://suppsite/SuppServices/OLOS.asmx/<method>. What you'll need to do, is implement a TransformRequest in your Bridge codebehind, and as part of this, you need to set the ServiceUrl of the BridgeRequestl on the BridgeContext to the correct serviceUrl for your method. Since this is asmx, I imagine what you want to do is something like:

public override void TransformRequest() {
BridgeRequest.ServiceUrl = BridgeRequest.ServiceUrl + "/" + BridgeRequest.Method;
base.TransformRequest();
}

Hope that helps,
-Hao


Thanks for the response. Indeed that woulddefinitely help, at least a little bit later in the development phase.

What I am actually trying to do here is: I want to have all the methods for this web service(http://suppsite/SuppServices/OLOS.asmx/) defined in the same .asbx.

I know that changing serviceUrl tohttp://suppsite/SuppServices/OLOS.asmx/getGeodisInfo does the job, but then the rest of the methods defined in the .asbx are not callable. Using the url suffixed with the method name, works only if the web service has GET support, otherwise is not working for me. I also need to get this working when the web service works with POST only. I currently do not need transforms for method returns... at least not for all of them.

Is there a way to define in the same .asbx multiple methods and use them from javascript(except the way provided in the above sample)?


What I posted below dynamically changes the serviceUrl for each bridge request to be the correct one based on the method being called, which indeed it only works for GET, but if you want to support POST for asmx, you will need to build your own Proxy type for the bridge to make POST requests in the format ASMX expects, as the RestProxy only supports GET requests.

Hope that helps,
-Hao


Thanks Hao, everything is crystal clear now.

Wednesday, March 21, 2012

CalendarExtender: 2007-05-2 is a wrong date

I am not sure how big of a problem this is but here I got this response from of our customers endusers regarding the CalendarExtender.
Her "errorreport" suggested that the control failed to return the wrong dateformat. The format for today would be 2007-05-2 (swedish locale) which IRL looks unnatural because we write it as 2007-05-02 normally. Even though the dates are exactly identical it still causes confusion.

Any idea on how to fix this?

Hi,

try using to set the Format property of the Calendar Extender which would probably be in your case something like yyyy-MM-dd. Also take a look at this post:EnableGlobalization property on the ScriptManager.

Grz, Kris.


EnableScriptGlobalization="true" alraeady was set on the ScriptManager. However the formatstring was yyyy-MM-d, when I changed it to yyyy-MM-dd it worked.