J
John Bailo
Look at my example:
<soap:Body>
<HelloWorld xmlns="http://tempuri.org/">
<i>SOME INTEGER</i>
</HelloWorld>
</soap:Body>
HelloWorld is the web method.
"i" is the input parameter
In your case I don't see a web method mentioned. You are just sending
the input parameter "PurchaseOrder".
I would think you would need to say
<SOAP-ENV:Body><MYMETHOD xmlns="http://someuri.com">
<PurchaseOrder><OrderHeader>
<BuyerOrderNumber>TestPo1</BuyerOrderNumber>...
<soap:Body>
<HelloWorld xmlns="http://tempuri.org/">
<i>SOME INTEGER</i>
</HelloWorld>
</soap:Body>
HelloWorld is the web method.
"i" is the input parameter
In your case I don't see a web method mentioned. You are just sending
the input parameter "PurchaseOrder".
I would think you would need to say
<SOAP-ENV:Body><MYMETHOD xmlns="http://someuri.com">
<PurchaseOrder><OrderHeader>
<BuyerOrderNumber>TestPo1</BuyerOrderNumber>...
Bryan said:I know that there is a SOAP Body in the GIS. This is what it looks like:
--------------------------------
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><PurchaseOrder><OrderHeader><BuyerOrderNumber>TestPo1</BuyerOrderNumber>...
--------------------------------
I'm trying to get to the "<PurchaseOrder><OrderHeader>..." part.
My boss just emailed me and said that I need to modify my Web service to be
this...
-------------------------------
<WebMethod(),
SoapDocumentMethod(Action:="http://www.source.com/webservices/CreateSourceOrder",
_
Use:=Description.SoapBindingUse.Literal,
ParameterStyle:=SoapParameterStyle.Bare)> _
Public Function
CreateSourceOrder(<XmlElement([Namespace]:="http://www.source.com/webservices",
IsNullable:=True)> _
ByVal PurchaseOrder As String) As
String
or ...
<WebMethod(),
SoapDocumentMethod(Action:="http://www.source.com/webservices/CreateSourceOrder",
_
Use:=Description.SoapBindingUse.Literal,
ParameterStyle:=SoapParameterStyle.Bare)> _
Public Function
CreateSourceOrder(<XmlElement([Namespace]:="http://www.source.com/webservices",
IsNullable:=True)> _
ByVal PurchaseOrder As Xml.XmlNode) As
String
-------------------------------
Neither worked. For right now, I have code that tests to see if the string
or XmlNode has anything in it and both came back saying they were empty or
null. Does this help clarify anything?
Ok, now I understand why you ask about SOAP.
Your server (GIS) is using a script that is actually putting together a
raw SOAP message direct to the web service.
If you run your web method in VS.NET (run the service, click on the
method) you will see how to call the service with SOAP and what the
response of the web service will be.
So, I wrote a very quick and dirty web service that takes an int as input
and adds that to a string.
[WebMethod]
public string HelloWorld(int i)
{
return "Hello World " + i.ToString();
}
Here is how VS.NET says I should call that service:
POST /test2/Service1.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/HelloWorld"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<HelloWorld xmlns="http://tempuri.org/">
<i>int</i>
</HelloWorld>
</soap:Body>
</soap:Envelope>
So, what you need to do is to find out if there is a [SOAPBODY] in your
GIS scripting language and code up the soap request message from VS.NET
Bryan said:I'm not worried about GIS receiving my web services' output; I need to
find GIS' input to my web service program. And yes, I can view my web
service as it's deployed on the server box
(http://servername/Service1.asmx). The GIS script sets a few internal
variables (SOAPRequestURL=http://localhost/Service1.asmx,
SOAP_Action=http://namespace/webservices/WebMethod,
SOAPEnvNSURI=http://schemas.xmlsoap.org/soap/envelope) then just 'calls'
the web service specified.
Yes, but even still, there has to be a way of retrieving a variable from
a web method right?
I mean, if you wrote a web method that returned an integer:
int myMethod()
{
return 1;
}
How would you get the value of "1" in the script language?
Also, are you saying that you can't reach your development machine across
the network from the GIS? Is there no way to say
URL="http://mymachine.mycompany.com/Webservice1.asmx" ?
Bryan Dickerson wrote:
I wish it were that easy. The script code is an XML-based language that
looks nothing like VB or C#. Plus the GIS Server is actually running on
another box, so I have to build my WS and deploy it to the GIS server
box, which is running on Win 2K3, then set a test in motion from the GIS
menus to see what response I get from my WS.
What does the script code look like on the GIS that you use to call the
.NET web service?
Basically, I would expect that you create an object that represents the
web service, and your web method should return a variable of type
XmlDocument to the GIS script.
FYI, you know, that you can put your web service into debug mode, and
set breakpoints, so that when the GIS calls it, you can make sure its
being called.
Bryan Dickerson wrote:
Close, I'm not able to see the XMLDocument that is passed. Where
should I be looking? The Sterling Commerce folks say that I should be
looking in the SOAP Body, but I don't understand how that translates
to an object that I should instantiate.
So, the GIS consumes your web service which sends it an XmlDocument?
That is, your web method is something like:
[WebMethod]
public XmlDocument myMethod(int i)
{
XmlDocument xd;
[...]
return xd;
}
And you are not able to retrieve xd in the GIS script?
Bryan Dickerson wrote:
3. My scenario is the reverse of what you describe. GIS is Gentran
Integration Suite by Sterling Commerce. It is a java-based server
from which I am trying to call my .Net web service, i.e., GIS is the
consumer. Actually, I am able to call my web service from scripts in
GIS, but (I'm the programmer on both ends, which pits me against
myself--is there a higher meaning to this?!) from within my .Net web
service, I am not able to figure out where the XML document, that is
supposedly within the SOAP Body, per the Technical Assistants from
Sterling Commerce, is. If I could figure that out, I would be home
free. I am able to get some response from my web service program,
just not the one that I want.
BTW, thanx for your patience!
1. All web services are called using SOAP -- which uses XML. I
really wouldn't focus on that. It's background.
2. java and .NET encapsulate and consume services in the same way.
A c# client can consume a java web service, and vice versa.
3. I think that they are confusing "web service" with "web
consumer" or "client". I am presuming that the GIS provides web
services, and that you will call their web methods with a web
client that you write, and that one of those web methods will
return a datatype of XmlDocument.
4. If so, you can use the method below.
To me, it sounds like your real job is to verify the scenario I
outlined in (3). I mean, is this GIS being offered via the web?
Or is it set up by someone in house?
Bryan Dickerson wrote:
Ok, here's the full scope of the problem: I am trying to work with
a 3rd party product called GIS that is essentially a java-based
EDI product and the documentation and 'technical assistants' (term
used loosely) say that 'it will use SOAP to call my (.Net) web
service and it will pass an XML Document to it in the SOAP Body
and that XML document is what my web service is supposed to work
with.' Does that make any sense? I'm not sure that it does to
me, but it seems the best way that I can understand it.
First of all forget about SOAP -- SOAP is an encapsulation method
that makes all datatypes available. It is a messaging protocol
basically. The fact that it uses XML has nothing to do with what
you're asking, which is "how do I retrieve the results of a web
method whose return type is XmlDocument".
Here is the method I use:
XmlDocument dom = new XmlDocument();
//this is a web method that returns a list of clients as an
XmlDocument
XmlNode lcx = lc.ClientList();
//this turns the XmlDocument from my webservice into
//something I can use locally
dom.AppendChild(dom.ImportNode(
lcx
,true));
Bryan Dickerson wrote:
Maybe I didn't phrase the question correctly. If my web service
is called via SOAP and an XML document is sent in the SOAP
message body, what object would I instantiate and what property
would I need to get that XML string so that I could do something
with it?