Re: Axis newbie, .NET idiot; add web reference of wsdl file generating errors? SOAP header params how-to?

2005-05-13 Thread Anne Thomas Manes
Todd, 

SOAP Headers are supposed to be defined as document/literal. Axis
doesn't support mix and match of soap messages (header in doc/literal
and body in rpc/encoded), so it's best to just use doc/literal when
using soap headers. On top of that, if you want to interoperate with
.NET you should use the "wrapped" convention.

Here's an updated version of your WSDL defined using the "wrapped" convention:


http://localhost:8080/avalanche/services/currency";
   xmlns:impl="http://localhost:8080/avalanche/services/currency";
   xmlns:intf="http://localhost:8080/avalanche/services/currency";
   xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
   xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
   xmlns:xsd="http://www.w3.org/2001/XMLSchema";>

   
   
   http://localhost:8080/avalanche/services/currency";
   xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
   xmlns:xsd="http://www.w3.org/2001/XMLSchema";
   xmlns:xsd1="http://localhost:8080/avalanche/services/.xsd1";>
   
   
   
   
   
   
   

   
   
  
 
  
   
   
  
 

 
  
   
   

   
   
   

   
   
   
   
   
   
   
   
   

   
   
   
   
   
   
   
   
   
   
   
   
   http://schemas.xmlsoap.org/soap/http"/>

   
   
   
   
   
   
   
   
   
   
   
   
   

   
   
   
   http://localhost:8080/avalanche/services/currency"/>
   
   



On 5/13/05, Todd Grinnell <[EMAIL PROTECTED]> wrote:
> I have two questions that I hope y'all can help me with. Here's a little 
> background on why I'm bothering y'all. We've got a bunch of java interfaces 
> being used via RMI, now we want to expose them via web services, too. We do 
> our own authentication, so I was thinking the easiest thing is to have the 
> client call the authentication method, and then pass the resulting 
> authentication token as a header arg-that way the existing java interfaces 
> don't need to change.
> 
> Question 1) I'm also not such a smartie about wsdl. (I'm sure you're 
> wondering if I'm a smartie about anything ;-) ) The WSDL for my service is 
> below. It works just fine with WSDL2Java, and the generated Java client stubs 
> do just what I want them to. However, when I Add Web Reference in .NET, it 
> gives an error, "the element attribute is not allowed on encoded message 
> parts". If I change the part specification from " element="intf:authToken" name="auth_header"/>" to " type="intf:authToken" name="auth_header"/>", it says "The datatype 
> 'authToken' is missing.", and WSDL2Java says the same thing. If I undo that 
> change and change the operation to be literal, then it says that "The 
> combination of style=rpc with use=literal is not supported." If I change it 
> to style=document, it says "Unable to import operation 'getExchangeRate'. 
> Specified cast is not valid."
> 
> Would someone take pity on the noob and help me with my WSDL?
> 
> Question 2) I know virtually nothing about c#, but someone gave me a test 
> program that calls a web service.  I was able to figure out how to add my web 
> service to the environment, and add a call to it from the little program, but 
> what do I do about header args? Could someone help me figure how to pass a 
> SOAP header argument on the call? Or will this problem be magically solved 
> once I can successfully import the web service? Here's the code I have:
> 
> FirstSOAPTest.CurrencyService.CurrencyWebServiceService curServ = new 
> FirstSOAPTest.CurrencyService.CurrencyWebServiceService();
> // The value of a proper authToken is in this.textBoxAuthReturn.Text
> double s = curServ.getExchangeRate();
> 
> The WSDL is what was generated by Axis, and then I added the bits about a 
> header arg (the parts I added are surrounded by blank lines). Here's my WSDL:
> 
> 
>  targetNamespace="http://localhost:8080/avalanche/services/currency";
> xmlns:impl="http://localhost:8080/avalanche/services/currency";
> xmlns:intf="http://localhost:8080/avalanche/services/currency";
> xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
> xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
> xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
> 
> 
> 
>  
> targetNamespace="http://localhost:8080/avalanche/services/currency";
> xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
> xmlns:xsd="http://www.w3.org/2001/XMLSchema";
> xmlns:xsd1="http://localhost:8080/avalanche/services/.xsd1";>
> 
> 
> 
>   

Axis newbie, .NET idiot; add web reference of wsdl file generating errors? SOAP header params how-to?

2005-05-13 Thread Todd Grinnell
I have two questions that I hope y'all can help me with. Here's a little 
background on why I'm bothering y'all. We've got a bunch of java interfaces 
being used via RMI, now we want to expose them via web services, too. We do our 
own authentication, so I was thinking the easiest thing is to have the client 
call the authentication method, and then pass the resulting authentication 
token as a header arg-that way the existing java interfaces don't need to 
change.

Question 1) I'm also not such a smartie about wsdl. (I'm sure you're wondering 
if I'm a smartie about anything ;-) ) The WSDL for my service is below. It 
works just fine with WSDL2Java, and the generated Java client stubs do just 
what I want them to. However, when I Add Web Reference in .NET, it gives an 
error, "the element attribute is not allowed on encoded message parts". If I 
change the part specification from "" to "", it says "The datatype 'authToken' is missing.", and 
WSDL2Java says the same thing. If I undo that change and change the operation 
to be literal, then it says that "The combination of style=rpc with use=literal 
is not supported." If I change it to style=document, it says "Unable to import 
operation 'getExchangeRate'. Specified cast is not valid."

Would someone take pity on the noob and help me with my WSDL? 

Question 2) I know virtually nothing about c#, but someone gave me a test 
program that calls a web service.  I was able to figure out how to add my web 
service to the environment, and add a call to it from the little program, but 
what do I do about header args? Could someone help me figure how to pass a SOAP 
header argument on the call? Or will this problem be magically solved once I 
can successfully import the web service? Here's the code I have:

FirstSOAPTest.CurrencyService.CurrencyWebServiceService curServ = new 
FirstSOAPTest.CurrencyService.CurrencyWebServiceService();
// The value of a proper authToken is in this.textBoxAuthReturn.Text
double s = curServ.getExchangeRate();


The WSDL is what was generated by Axis, and then I added the bits about a 
header arg (the parts I added are surrounded by blank lines). Here's my WSDL:


http://localhost:8080/avalanche/services/currency";
xmlns:impl="http://localhost:8080/avalanche/services/currency";
xmlns:intf="http://localhost:8080/avalanche/services/currency";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>



http://localhost:8080/avalanche/services/currency";
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";
xmlns:xsd1="http://localhost:8080/avalanche/services/.xsd1";>



























http://schemas.xmlsoap.org/soap/http"/>





http://schemas.xmlsoap.org/soap/encoding/";
namespace="http://currency.examples.ecm.opentext.com"; 
use="encoded"/>
http://schemas.xmlsoap.org/soap/encoding/";
message="impl:getExchangeRateRequest"
part="auth_header"
use="encoded"/>


http://schemas.xmlsoap.org/soap/encoding/";

namespace="urn:http://localhost:8080/avalanche/services/currency";
use="encoded"/>


  
  



http://localhost:8080/avalanche/services/currency"/>






--
'Peace is not merely a distant goal that we seek, but a means by which we 
arrive at that goal' Dr. M. L. King, Jr.
Todd Grinnell ( mailto:[EMAIL PROTECTED] ) Open Text Corp. Chicago 'burbs, IL 
Contact me for a public key