views:

559

answers:

2

Background: I'm calling a Web Service written in ASP.NET that queries an Oracle database. I know the Web Service itself works, because I've used it before other applications. So I have a web application in Visual Studio that I've been switching back and forth to point from a 'DEV' web service to a production configured version of the same web service for testing. Pointing to the 'DEV' configured web service is no problem, but calling the production version I always get an exception calling the service:

SoapException was unhandled by user code
Server was unable to process request. ---> could not execute query
[ SELECT this_.FIELD1 as FIELD1_18_0_, this_.FIELD2 as FIELD12_18_0_ FROM ABC.TABLE_A this_ WHERE this_.FIELD1 like :p0 ORDER BY this_.FIELD1 asc ]
Positional parameters:  #0>00073%
[SQL: SELECT this_.FIELD1 as FIELD1_18_0_, this_.FIELD2 as FIELD12_18_0_ FROM ABC.TABLE_A this_ WHERE this_.FIELD1 like :p0 ORDER BY this_.FIELD1] ---> ORA-12571: TNS:packet writer failure

I ran the SQL queries against the appropriate database (cut and pasted straight out of the exception message) and the query came back with the expected data. I've tried updating and re-adding the Web Service reference both as a "Service Reference" (.NET 3.0+ way) and as a "Web Reference" (Older .NET way), and both give the same error.

Question: So, what does a "ORA-12571: TNS:packet writer failure" error mean in the context of a Web Service? Looking up the Oracle Error number gives some very vague possible causes such as "loose cable connection" or "IP address conflict". I'm fairly certain it's neither of these, since a different application is currently successfully using that Web Service. Possibly some kind of configuration error, or maybe something more subtle? Anyone else seen this vexing Oracle error number being attributed to something web-service related?

+1  A: 

I would suggest re-examining your assumptions more carefully, as this is clearly an error in the web-service dialogue with the db and should be completely independent of the w/s caller.

If the w/s call is generating this specific exception, it should be doing so for all other invocations, so your 'other application' that's using the web service successfully is simply not executing the same code or there are outside factors at play.

Either way, it's unrelated to how the service is registered or invoked.

Nariman
Aha, you are very much correct! I was thinking my client was incorrectly configured for the web service, but the real problem was the web service itself not communicating correctly to Oracle.
Ogre Psalm33
+1  A: 

Your call is going from the ws client to the ws server to the oracle database.

Your error is an ORA error, which is generated by the database. So your problem is probably between the ws server and the database.

When you ran "the SQL queries against the appropriate database", did you do it from the web server? If not could you try that. Make sure that you are using the same connection configuration.

EDIT

As per the comment below, the real problem was a driver mismatch.

Shiraz Bhaiji
This is closest to the actual solution, and got me thinking down the right path. The real problem was that the Oracle driver on our production server is only an Oracle 8.x driver, but the database that the Web Service was trying to communicate with was an Oracle 9.2 database. So apparently a driver to database version mismatch can cause the ORA-12571 error. If you want to edit your answer to include driver version mismatch as a possible cause, it might be helpful to future persons searching for a similar solution. :-)
Ogre Psalm33
Some additional information, in case anyone else ever stumbles across this issue. The above fix (updating the Oracle driver to 9.2) helped on our "test" server, but did not fix the production server. We are using NHibernate as our ORM solution, and we eventually discovered that the test server and production server had different versions of .NET (.NET 3.5 SP1 vs .NET 3.5 w/no SP). We updated the prod server with .NET 3.5 SP1, and voila, the issue went away on there as well. Long story short: (Web Service using NHibernate), we had to update Oracle to 9.2 and .NET to 3.5 SP1.
Ogre Psalm33