Hi,
if you create an asmx - File, you dont need a wsml file!
A wsdl-file will create on demand if you write:
localhost/xyWeb.asmx?wsdl
you will need the wsml file if you want to use a listener (asp-file).
So,
1. create an asmx -file
2. use the java client like this:
import java.io.*;
import java.util.*;
import java.net.*;
import org.w3c.dom.*;
import org.apache.soap.util.xml.*;
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.encoding.soapenc.*;
import org.apache.soap.rpc.*;
import org.apache.soap.util.Bean;
import org.apache.soap.encoding.literalxml.XMLParameterSerializer;
import org.apache.soap.server.*;
import org.apache.soap.transport.http.SOAPHTTPConnection;
public class testClient {
public static void main(String[] args) throws Exception {
//1. Where is the webservice
******************************************************
URL mUrl = new URL
("http://localhost/webs/myweb/myweb4.asmx");
//2. Namespace for Input at binding with SOAP (URI for the INPUT
at SOAP) ********
String inputUri = "urn:xGetStoreInfoRequest";
//3. soapAction (a URI for the methode)
*************************************
String methodSoapAction = "urn:xGetStoreInfo";
//4. methodename ***********************************
String methodeName = "GetStoreInfo";
//5. all parameters ***************************************
Vector params = new Vector();
params.addElement(new Parameter("id", String.class, 7066,
Constants.NS_URI_SOAP_ENC));
//6. Uri EncodingStyle
*********************************************************
String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
//7. an appropriate Serializer/Deserializer, here i get a string
StringDeserializer sd = new StringDeserializer();
SOAPMappingRegistry smr = new SOAPMappingRegistry ();
smr.mapTypes (Constants.NS_URI_SOAP_ENC, new QName ("",
"storeinfo"), null, null, sd);
// create the transport and set parameters
SOAPHTTPConnection st = new SOAPHTTPConnection();
// ein call erstellen
Call call = new Call();
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC) ;
call.setSOAPTransport(st);
call.setSOAPMappingRegistry(smr);
call.setTargetObjectURI(inputUri);
call.setMethodName(methodeName);
call.setEncodingStyleURI(encodingStyleURI);
call.setParams(params);
Response resp = null;
try
{
System.out.println ("Debug Point 1");
resp = call.invoke(mUrl,methodSoapAction);
System.out.println ("Debug Point 2");
}
catch (SOAPException e) {
System.err.println("Caught SOAPException (" + e.getFaultCode
() + "): " + e.getMessage ());
return;
}
// check response
if (resp != null && !resp.generatedFault())
{
Parameter ret = resp.getReturnValue();
Object value = ret.getValue();
System.out.println ("Answer--> " + value);
}
else
{
Fault fault = resp.getFault ();
System.err.println ("Generated fault: ");
System.out.println (" Fault Code = " + fault.getFaultCode
());
System.out.println (" Fault String = " +
fault.getFaultString());
}
}
}
Try this client and hange the point 1. - 7. to your own settings.
This works with an asmx file (i hope :o) )
try this an tell if it works
CU (from the completely beginners :o) )
TheMotorcycles@inf
omedica.it To: [EMAIL PROTECTED]
cc:
29.08.2001 12:43 Subject: Rif: Re: .NET service
Please respond to
soap-user
thanks,
but i have some thinks that don't work fine.
in java i do a think like this with a com service
url = new URL ("http://localhost:8040/Hello2/Hello2.asp");
:
call.setMethodName("HelloWorld");
:
params.addElement(new Parameter("sName", String.class, "Federico", null));
:
resp = call.invoke (url, "http://tempuri.org/action/Hello2.HelloWorld");
:
and i have the result. the Hello2.asp is a page that i have build with soap
toolkit, and this page uses two file: hello2.wsdl and hello2.wsml.
:
WSDLFilePath = Server.MapPath("Hello2.wsdl")
WSMLFilePath = Server.MapPath("Hello2.wsml")
:
SoapServer.Init WSDLFilePath, WSMLFilePath
:
when i build a service with .NET, i don't have a asp page to call. i can
create a wsdl file but i have't a wsml file to use in asp page.
if i use this syntax in my java client
url = new URL('http://localhost:8040/Hello2/service1.asmx');
i receive this error
Generated fault:
Fault Code = soap:Client
Fault String = System.Web.Services.Protocols.SoapException: Server did not
recognize the value of HTTP Header SOAPAction:
http://tempuri.org/action/Service1.HelloWorld.
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type,
Http Context context, HttpRequest request, HttpResponse response)
where is my error?
federico
Cong.Hoang.Hoang@
namics.com Per:
[EMAIL PROTECTED]
Cc:
08/29/2001 12:06 Oggetto: Re: .NET service
PM
Per favore,
rispondere a
soap-user
Hi federico,
it's depends on how you want to create the webservice
in .NET.
1. you write a webservice in, e.g. C#
the result is an asmx-file. In that case you can get the wsdl-File by
typing in your browser: localhost/theWebservice.asmx?wsdl
To use this kind of service, you don't need the wsml file.
or
2. you use the soap sdk to create the wsdl and wsml file.
(you have to write a dll in VB and use the WSDl Generator from the SOAP
SDK from Microsoft)
In that case, you will get wsdl, wsml and the listener (the asp-File)
If you want to call the service from .NET there are different ways.
...
URL url = new URL("http://localhost/theWebservice.asp");
...
or
...
URL url = new URL("http://localhost/theWebservice.asmx");
...
If you create an ISAPI listener (you can choos it in the WSDL Genertaor
Wizard of SOAP SDK):
...
URL url = new URL("http://localhost/theWebserviceIsapi.wsdl");
...
Hope thats help a bit
cheers
TheMotorcycles@inf
omedica.it To:
[EMAIL PROTECTED]
cc:
29.08.2001 11:31 Subject: .NET service
Please respond to
soap-user
i've created a simple service with .NET (on IIS 5.0 web server). i want
call this service from java client. how can i do? i need the wsdl? is it
sufficient?
i have a client java that speek with a com soap service. to do so, i need
to pass throught a asp page and i need of two files: wdsl and wsml.
when i build a service with .NET, these files aren't created.
any suggestion?
federico