axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Seifert <eseif...@waca.com>
Subject RE: Can someone help
Date Wed, 25 Feb 2004 19:22:13 GMT
I got it to work but....
I have tcptrace running and it works now. When I turn tracing off and close
the application I get a connection refused error.... Dangit.... Anyone know
why that would be?
Also, not sure if everything here is correct so if someone can let me know
that I actually set everything properly that would be a big help. Thanks.
1) SoapRpcService
2) Asmx File contents
 	[SoapRpcService( RoutingStyle=SoapServiceRoutingStyle.RequestElement
),
	WebService(Namespace="http://tempuri.org/", Name="Service1")]
	public class Service1 : System.Web.Services.WebService
	{
		public Service1()
		{
			InitializeComponent();
		}

		[WebMethod]
		public string StringTest( string dataIn )
		{
			return dataIn;
		}
	}

wsdl contents
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
targetNamespace="http://tempuri.org/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
  <types />
  <message name="StringTestSoapIn">
    <part name="dataIn" type="s:string" />
  </message>
  <message name="StringTestSoapOut">
    <part name="StringTestResult" type="s:string" />
  </message>
  <portType name="Service1Soap">
    <operation name="StringTest">
      <input message="tns:StringTestSoapIn" />
      <output message="tns:StringTestSoapOut" />
    </operation>
  </portType>
  <binding name="Service1Soap" type="tns:Service1Soap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="rpc" />
    <operation name="StringTest">
      <soap:operation soapAction="http://tempuri.org/StringTest" style="rpc"
/>
      <input>
        <soap:body use="encoded" namespace="http://tempuri.org/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </input>
      <output>
        <soap:body use="encoded" namespace="http://tempuri.org/"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
      </output>
    </operation>
  </binding>
  <service name="Service1">
    <port name="Service1Soap" binding="tns:Service1Soap">
      <soap:address location="http://localhost/WaCA/WSTest/Service1.asmx" />
    </port>
  </service>
</definitions>

3) POST /WaCA/WSTest/Service1.asmx HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.1
Host: localhost
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "http://tempuri.org/StringTest"
Content-Length: 452

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <ns1:StringTest
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns1="http://tempuri.org/">
   <dataIn xsi:type="xsd:string">Hello</dataIn>
  </ns1:StringTest>
 </soapenv:Body>
</soapenv:Envelope>

HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Wed, 25 Feb 2004 19:16:15 GMT
X-Powered-By: ASP.NET
X-AspNet-Version: 1.1.4322
Cache-Control: private, max-age=0
Content-Type: text/xml; charset=utf-8
Content-Length: 550

<?xml version="1.0" encoding="utf-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://tempuri.org/" xmlns:types="http://tempuri.org/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><types:String
TestResponse><StringTestResult
xsi:type="xsd:string">Hello</StringTestResult></types:StringTestResponse></s
oap:Body></soap:Envelope>


-----Original Message-----
From: Wagh, Shrikant [mailto:shrikant.wagh@hp.com]
Sent: Wednesday, February 25, 2004 2:11 PM
To: axis-dev@ws.apache.org
Subject: RE: Can someone help


Hello Eric,

If you can provide the following information, that would help in
analyzing your issue.

1. Since your web service is deployed on .Net, is it a doc-lit type of
service? From your client program it looks like your service is
RPC-encoded. But can you double check your WSDL and verify that. Because
on .Net, by default services are deployed as doc-lit.
2. Can you post your WSDL/asmx file?
3. Can you use tcpmon and capture the SOAPRequest and post that too?

Best regards,
Shrikant Wagh
QA Lead, HPP/eProfile, HP

For those who are interested in Web Services testing:
-----------------------------------------------------
I found that WebServiceTester from Optimyz software is a very good tool
for testing any types of web services, and I'm great fan of this tool.
It supports all types of web services, and all simple and complex types
and it very usable than any other tool in the market I ever
used/evaluated. It automatically generates the SOAP requests and invokes
the intended web services. It can perform functional, regression and
load testing of web services. Result analysis and status reporting is
just wonderful.  I'll highly recommend this tool for testing web
services, saves lots of time and efforts in testing web services. For
more information visit http://www.optimyz.com.

DISCLAIMER 
================================================================
THESE ARE MY PERSONAL VIEWS/OPINIONS AND DOES NOT REPRESENT HP, AND THE
INFORMATION PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
THE I/HP BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
INFORMATION, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=================================================================

-----Original Message-----
From: Eric Seifert [mailto:eseifert@waca.com] 
Sent: Wednesday, February 25, 2004 8:27 AM
To: 'axis-dev@ws.apache.org'
Subject: Can someone help

I'm trying to access a .net web service from a java client. I've tried
it 2
different ways. One way is in the code below which gives me this error: 
System.Web.Services.Protocols.SoapException: Server was unable to read
request. ---> System.InvalidOperationException: There is an error in XML
document (4, 2). ---> System.InvalidOperationException: <StringTest
xmlns='http://tempuri.org/'> was not expected.

The other way is that I downloaded the jbuilderx trial and tried using
the
axis emitter that the ide uses to auto generate the stub classes then
used
those to make a call to the the web service and I get this error:
System.Web.Services.Protocols.SoapException: Server did not recognize
the
value of HTTP Header SOAPAction: http://tempuri.org/rpc.

I've changed my .net web service numerous times and still can't seem to
get
it to work. Even followed the instructions on the msdn site for
integration
with java and that didn't help any. Can someone help me out please.
Thanks.
Eric


	public void sendXMLString()
	{
		System.out.println("SendXML.sendXMLString()");
		try {
			System.out.println("here we go again...");
			URL url = new URL
("http://wcatl64/WaCA/WSTest/Service1.asmx");

			SOAPMappingRegistry smr = new
SOAPMappingRegistry
();
			StringDeserializer sd = new StringDeserializer
();
			QName qn = new QName("http://tempuri.org/",
"StringTestResult");
			smr.mapTypes( Constants.NS_URI_SOAP_ENC, qn,
null,
null, sd );

			// create the transport and set parameters
			SOAPHTTPConnection st = new
SOAPHTTPConnection();

			// build the call.
			Call call = new Call ();
			call.setSOAPTransport(st);
			call.setSOAPMappingRegistry (smr);

			call.setTargetObjectURI ("http://tempuri.org/");
			call.setMethodName("StringTest");
			call.setEncodingStyleURI(
Constants.NS_URI_SOAP_ENC
);

			Vector params = new Vector();
			params.addElement( new Parameter(
"StringTestResult", String.class, "hello world", null ) );
			call.setParams(params);

			Response resp = null;
			resp = call.invoke (url,
"http://tempuri.org/rpc");
			System.out.println(" ");
			System.out.println("****");
			System.out.println("resp.generatedFault() value:
"+resp.generatedFault());
			if ( !resp.generatedFault() )
			{
				System.out.println("1");
				Parameter ret = resp.getReturnValue();
				System.out.println("2");
				Object value = ret.getValue();
				System.out.println("3");
				System.out.println("value:  "+value);
				System.out.println("4");
			}
			else
			{
				Fault fault = resp.getFault();
				System.err.println("Generated fault: ");
				System.out.println ("  Fault Code   = "
	
+
fault.getFaultCode());
				System.out.println ("  Fault String = "
	
+
fault.getFaultString());
			}
			System.out.println("****");
			System.out.println(" ");
		}
		catch (SOAPException e) {
			System.err.println("Caught SOAPException (" +
e.getFaultCode () + "): " + e.getMessage ());
			return;
		}
		catch ( MalformedURLException urlE )
		{
			System.err.println("MalformedURLException -
SendXML.sendXMLString - message");
		}

	}

Mime
View raw message