We have a web-service within an existing ASP.NET website which works fine when accessed via other ASP.NET bits. I'd like to get Excel 2007 and 2003 to call the w-s and refresh part of a worksheet with the results using VBA.
Ideally I'd like a vanilla version of Excel to be able to do this (ie without the client having to install extra bits).
As a starter (in 2007) I tried Data->Get External Data->From Web. Pointed it at : http://myhost/myvirtdir/ABCInfoWS.asmx?WSDL&op=testwebservice1
Stuff appears in Excel (albeit with 'The Specified XML source does not refer to a schema' message) but it turns out that it's actually a description of all web-services offered under the same WSDL.
Can anyone tell me how I can get the data from testwebservice via VBA ?
Remove the ?WSDL part from the URL above.
EDIT: What does your webservice return?
Excel's Data -> Import Data expects a tabular structure built with tr & td to get the data in.
If your webservice returns XML, it should work as well.
Sorry it turns out I can't provide enough infromation via comments. This is what is appearing in Excel when I select SOAP 2 and XML:
Just responding to your edits my w-s returns XML and this is what it looks like - it doesn't contain tr/td because it's previously been used as a 'real' webservice .
I've realised that I'm not getting the actual data at all but instead a description of the data that the webservice provides - I guess my URL is still off the beat a bit ?
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<GetBookJobStatusResponse xmlns="http://www.protecttheguilty.com/">
<GetBookJobStatusResult>
<BookJobStatus>
<JobStatus>string</JobStatus>
<JobType>string</JobType>
<RequestTime>dateTime</RequestTime>
<StartTime>dateTime</StartTime>
<EndTime>dateTime</EndTime>
<PathToOutput>string</PathToOutput>
</BookJobStatus>
<BookJobStatus>
<JobStatus>string</JobStatus>
<JobType>string</JobType>
<RequestTime>dateTime</RequestTime>
<StartTime>dateTime</StartTime>
<EndTime>dateTime</EndTime>
<PathToOutput>string</PathToOutput>
</BookJobStatus>
</GetBookJobStatusResult>
</GetBookJobStatusResponse>
</soap12:Body>
</soap12:Envelope>
Related
I am new to BizTalk and I need to read some values from a SQL Server table. An example of the result set I am getting is the follow:
<SelectResponse
xmlns="http://schemas.microsoft.com/Sql/2008/05/TableOp/dbo/tableName">
<SelectResult>
<tableName xmlns="http://schemas.microsoft.com/Sql/2008/05/Types/Tables/dbo">
<Message> <item_1> item_1Value </item_1>
<item_2> item_2Value </item_2>
<item_3> item_3Value </item_3>
<item_n> item_3Value </item_n> </Message>
</tableName>
</SelectResult>
</SelectResponse>
So I get my message in BizTalk (the schema is auto-generated from SQL Adapter). What I want is the following:
<SelectResponse
xmlns="http://schemas.microsoft.com/Sql/2008/05/TableOp/dbo/tableName">
<SelectResult>
<tableName xmlns="http://schemas.microsoft.com/Sql/2008/05/Types/Tables/dbo">
<Message>
<item_1> item_1Value </item_1>
<item_2> item_2Value </item_2>
<item_3> item_3Value </item_3>
<item_n> item_3Value </item_n>
</Message>
</tableName>
</SelectResult>
</SelectResponse>
I have the new schema (for item_1, item_2, ...). Considering that <Message> can appear multiple times inside the BizTalk message, what is the easier way to get what I need and how can I do that? Thanks.
The most likely reason you are seeing this is the item Xml content is stored within another Xml structure, Message. Xml stored within Xml is escaped so this isn't an actual problem, it's the expected behavior.
You have several options including:
Use a Stored Procedure that loads and handles the item Xml as Xml and not a string in the result.
In an Orchestration, extract the item Xml, reformat to include a root element and create a new Message based on that.
The problem is how this data has been stored, not how SQL Server is returning it or how BizTalk is presenting it.
I've been given an existing application to work on which uses ColdFusion as a service. I'm a beginner with ColdFusion, however most of it I've been able to figure out. Now, I've been given a task to edit some existing reports and for some reason I'm having trouble determining where the headers for the columns are located. The .cfc file that the report URL calls looks like this:
<cffunction
name="report"
access="remote"
hint="Generate a Report"
output="true"
roles="view"
>
<cfset report = this.reportGenerate(argumentCollection=arguments)/>
<cfcontent variable="#report#" type="application/pdf" reset="Yes">
</cffunction>
<cffunction
name="reportGenerate"
access="package"
hint="Generate a Report"
output="false"
returntype="binary"
etc.
I have .cfr files in the application but I don't have Report Builder and have no way to edit them. I see where the data is being generated but I can't determine where the column headers are defined (at least in this case). The report URL just calls the .cfc file (a portion of which is shown above). Can anyone clue me in as to where the column headers might be defined?
Thanks so much,
Pete
You should be calling the .CFR reports using the CFREPORT coldfusion tag.
And you need to install ColdFusion Report Builder tool to have a look of the Columns defined.
These Columns are dragged and dropped in the ColdFusion Report Builder tool.
And saved there as .CFR file.
This .CFR file needs to be invoked using the CFREPORT tag.
Query objects from CFC can be passed to the CF report Builder from where these values can be pasted at the tool.
Also parameters can be passed to the .CFR file.
I am working on an iPad app that is fed data via web service returning JSON. Watching some iTunes U episodes, it looks like sending back Plist would save me a ton of time and speed up my app quite a bit on the parsing side of things.
Does anyone know of a .net library that converts objects into this Plist to return instead?
EDIT (this is my very limited understanding of this topic):
An Plist is a Property List that iOS can use to easily encode and/or parse data. It is very similar to JSON except parsing takes a fraction of the time and can be done in 1 line of code. If your server uses WebObjects then encoding can also be done in 1 line of code, I am using IIS so I need a solution for this if one exists before I write my own.
You can see the videos here:
http://developer.apple.com/videos/wwdc/2010/
In particular watch Session 117 - Building a Server-Driven User Experience
You may checkout this project. Sample usage:
object value = ...
string plist = Plist.PlistDocument.CreateDocument(value);
The only requirement is to decorate your object with [Serializable] attribute.
If you're using WebObjects, the appserver from apple, there's a java mirror class of NSPropertyListSerialization that does all of this for you; you can pass it NSArray's, NSDictionaries, etc and it will just work. Not sure if that's what you're talking about; confused as to the WebObjects in your question. HTH's.
I've got a simple ASP.NET webservice. I'm wanting to return a string of json as the result. By default, my webservice is wrapping my json result in some xml.
eg.
<?xml version="1.0" encoding="utf-8"?>
<string xmlns="http://webservice.streetadvisor.com/">{.... json result in here ... }</string>
Booo.
Is there any way i can make my webservice NOT return some xml, but just write my result as raw output?
Can I define the HTTP-StatusCode in the webservice? eg. 200, 201, 202, 404, 500, etc?
Can i define the response type? eg. application/json
Cheers!
You can do this fairly easily by creating a .ashx handler instead of a normal web service - but at that point you lose a lot of the infrastructure around web services, in particular anything interpreting the data coming from the client in the structured way that SOAP gives you.
Here's an example of creating an RSS feed as a "raw" handler, and here's a more general tutorial. It's not particularly tricky - if those don't help you much, do a search for ashx and you'll get lots of hits.
I don't know how easy it is to do from a web service project though - I've only done it from a straight ASP.NET web application project. It may well "just work" though - it's worth a try.
Sometimes if im wanting to return JSON i just use a .aspx page with:
Response.Clear();
Response.ContentType = "text/javascript";
Then using a .NET Json framework (like the 1 here) i create the json i want it to return.
You can simply use
[WebMethod]
[System.Web.Script.Services.ScriptMethod(ResponseFormat = System.Web.Script.Services.ResponseFormat.Json)]
This worked for me.
I need to create a service that will return XML containing data from the database. So I am thinking about using an ASHX that will accept things like date range and POST an XML file back. I have dealt with pages pulling data from SQL Server and populating into a datagrid for visual display but never into XML for delivery, what is the best way to do this? Also if an ASHX and POST isn't the best method for delivery let me know... thanks!
EDIT: These answers are great and pointing me in the right direction. I should have also mentioned that the XML format has already been decided so I can't use any automatically generated one.
Combining linq2sqlwith the XElement classes, something along the lines:
var xmlContacts =
new XElement("contacts",
(from c in context.Contacts
select new XElement("contact",
new XElement
{
new XElement("name", c.Name),
new XElement("phone", c.Phone),
new XElement("postal", c.Postal)
)
)
).ToArray()
)
);
Linq2sql will retrieve the data in a single call to the db, and the processing of the XML will be done at the business server. This splits the load better, since you don't have the sql server doing all the job.
Have you tried DataSet.WriteXml()?
You could have this be the output of a web service call.
Sql Server 2005 and above has a "FOR XML AUTO" command that will convert your recordset to XML for you. Then you just have to return a string from your ASHX.
Beginning with SQL Server 2000, you can return query results as XML. For absolute control of them, use the "FOR XML EXPLICIT" command. You can use any format you desire that way.
http://msdn.microsoft.com/en-us/library/ms189068.aspx
It's as easy as writing your result to the raw output then. For added points, you can return the result set to a XPathDocument, pass it through an XSL transformation, and send the results out in any format you choose (HTML vs XML at the click of a button perhaps).
you can obtained that to a datatable and then call myTable.WriteXML()
if you are populating classes with the your database results then add the serializable attribute to the header your classes, and use the XMLSerializer
Converting an automatically generated format into a specified one is a job for xslt. Just find a way to run the output from the tool through an xslt filter.
Oracle has a great product for doing exactly this job - the oracle XDK. But it's a java thing, not ASP as far as I know.
For an example, this XHTML
http://www.anbg.gov.au/abrs/online-resources/flora/stddisplay.xsql?pnid=2524
is generated automatically from this XML, which is generated by oracle
http://www.anbg.gov.au/abrs/online-resources/flora/stddisplay.xsql?pnid=2524&xml-stylesheet=none
Of course, you are not after XHTML, but some other XML format. But XSLT will do the job.