I have a page with javascript that's currently communicating with our web
service via the webservice.htc. This is already causing us some problems
with some windows clients who are behind firewalls as the SoapAction in the
header is getting stripped or changed in some way, resulting in failed
calls.
We don't need soap, we're just passing strings, but we do need the ability
to get responses synchronously, so I don't know if we even need a web
service, perhaps just an aspx called from javascript will work, but I can't
figure out how to get it to call the C# functions from javascript. Also how
would we get it to call and return a result?
TIA
Phil
Dino Chiesa [Microsoft] wrote:
> Seeing my name mentioned, I thought maybe I would weigh in here.
> I've never tried invoking a webservice from IE on the MAC.
>
> It is possible - not easy, but possible - to use either JavaScript or
> VBScript, and MSXML to invoke a webservice. And that can run within IE.
> (also within ASP or MSWord or WSH) But of course MSXML depends on
> Windows.
> http://groups.google.com/groups?q=MSXML+SOAP&num=30&hl=en&lr=lang_en&ie=UTF-8&sa
=N&scoring=d
>
> If the browser is the target, then I'd recommend architecting it so that
> the
> browser invokes a web form (ASPX), which in turn invokes the webservice
> (ASMX), and then returns results to the browser. The results from the
> ASPX, by the way, need not be a complete HTML page; it could be an HTML
> fragment that you could include in a DIV within IE. Actually, the the
> ASPX
> results don't need to be HTML at all. Could be XML (something like REST),
> or
> an image, or whatever.
>
> That way you need not worry about all combinations of browser and so on,
> being able to invoke webservices, handle SOAP faults, etc.
>
> -D
>
> > Ok, let me get this straight:
> > You're accessing a web service with client side scripting (Jscript)?
> >
> > --
> > Greetz
> >
> > Jan Tielens
> > ________________________________
> > Read my weblog: http://weblogs.asp.net/jan
> >
> > "Bent Kjeldsen" <news@n.o.spam.dithjem.dk> wrote in message
> > news:On0#S7k5DHA.564@TK2MSFTNGP10.phx.gbl...
> > > ASP.NET application. When you want to call a webservice from the
> > > client
> > you
> > > include webservice.htc, and then you use javascript ud communicate
> > > with
> > the
> > > webservice created in ASP.NET in an asmx file...
> > >
> > > But it does not work on Mac for me, but Dino Chiesa [Microsoft] wrote
> that
> > > it was possible, but not how...
> > >
> > > Bent
> > >
> > > "Jan Tielens" <jan@no.spam.please.leadit.be> wrote in message
> > > news:uRi6B5k5DHA.2720@TK2MSFTNGP09.phx.gbl...
> > > > I don't know what IE has to do with web services, unless of course
> > you're
> > > > using the generated test pages. How are you using web services, from
> an
> > > > ASP.NET application (Web.Forms) or from an Windows.Forms app?
> > > >
> > > > --
> > > > Greetz
> > > >
> > > > Jan Tielens
> > > > ________________________________
> > > > Read my weblog: http://weblogs.asp.net/jan
> > > >
> > > > "Bent Kjeldsen" <news@n.o.spam.dithjem.dk> wrote in message
> > > > news:#bNDEZk5DHA.1052@TK2MSFTNGP12.phx.gbl...
> > > > > Hello
> > > > >
> > > > > I have made several webservices in ASP.NET, and they work just
> > > > > fine
> on
> > > IE
> > > > on
> > > > > a Windows platform. But what about IE Mac client. I was told that
> > > > > it
> > is
> > > > > possible in an earlier post, but not howto!
> > > > >
> > > > > Anyone? Thanks...
> > > > >
> > > > > Bent
> > > > > Denmark
Dino Chiesa [Microsoft] - 22 Feb 2005 19:59 GMT
the webservice.htc approach has its limitations, which you have now
experienced.
Why can you not just do an HTTP / GET from Javascript? You can pass input
as Strings, and get output as strings, or use Xml, or whatever.
The url endpoint would be an ASPX page, that maybe, front-ends the existing
webservice. In other words, it would constitute an addiitonal HTTP/GET
(REST) interface on the webservice. The ASPX page would have to accept
different params corresponding to the C# "functions" you mentioned.
so invoke something like:
http://yourserver/Facade.aspx?s=Function1&p=param1
http://yourserver/Facade.aspx?s=GetCustomerDetails&p=01827436
and the Facade.aspx does not need to return HTML, you see. It can return
whatever it wants, a CSV file, a text string, an XML document, or whatever.
You can then parse it on the client (caller) side.
Again, I don't know IE on the MAC., but if it is scriptable, it should be
able to send out an HTTP/GET and then consume the result.
-D
>I have a page with javascript that's currently communicating with our web
>service via the webservice.htc. This is already causing us some problems
[quoted text clipped - 92 lines]
>> > > > > Bent
>> > > > > Denmark
Phil George - 23 Feb 2005 08:04 GMT
Thanks for the rapid response Dino, and apologies for previously responding
directly to you instead of the group. My fault for using outlook express as
my news client :-/
I was experimenting last night, and realized I could achieve the facade
approach with the XMLHttpRequest object, which from what I
understand, would need to be instantiated for IE like so:
var req = new ActiveXObject("Microsoft.XMLHTTP");
and for other browsers (Mozilla / Safari, and ?) like so:
var req = new XMLHttpRequest();
Are you describing a solution that uses the XMLHttpRequest object
or something in pure JavaScript? If I can support all recent
browsers then that would be a bonus.
Am I correct in thinking I'll be restricted to sending data from the
javascript to the facade.aspx via the querystring, and therefore
would have a 512 (as far as I recall) character restriction?
TIA,
Phil George
> the webservice.htc approach has its limitations, which you have now
> experienced.
[quoted text clipped - 118 lines]
>>> > > > > Bent
>>> > > > > Denmark
Dino Chiesa [Microsoft] - 28 Feb 2005 21:08 GMT
> I was experimenting last night, and realized I could achieve the facade
> approach with the XMLHttpRequest object, which from what I
[quoted text clipped - 9 lines]
> or something in pure JavaScript? If I can support all recent
> browsers then that would be a bonus.
I was thinking of MSXML and the ServerXMLHTTP component. I don't know what
that looks like in MAC.
This sample shows Javascript that invokes a webservice:
http://cheeso.members.winisp.net/srcview.aspx?dir=web-services&file=Soap-v4.js
It would need to be adapted to run within a browser.
> Am I correct in thinking I'll be restricted to sending data from the
> javascript to the facade.aspx via the querystring, and therefore
> would have a 512 (as far as I recall) character restriction?
I think the XMLHTTP and ServerXMLHTTP objects support HTTP POST. So, no
512-char limit.
-D