Skip to main content
MSO_Simon
Participant
October 12, 2009
Question

Multiple web services on single server causing object undefined errors

  • October 12, 2009
  • 1 reply
  • 1183 views

Hi,

I've currently got a bit of a strange problem within a web service that is proving difficult to debug.

There are the web service urls :

     api.domain.com                -> /var/www/html/api.domain.com/            -> CF mapping to MYSERVICE

     testapi.domain.com          -> /var/www/html/testapi.domain.com/     -> CF mapping to MYSERVICE_test

In both instances the cfcs that contain the code to be translated into a WSDL reside in /api/..., in the case of this example, /api/common.cfc.  wsargs constists simply of refreshwsdl true.

If I call the following 2 lines ...

     obj_myservice = CreateObject('webservice','http://api.domain.com/api/common.cfc?wsdl',wsargs);

     obj_myservice_test = CreateObject('webservice','http://testapi.domain.com/api/common.cfc?wsdl',wsargs);

I then call the same method in both, and they are successful.  When checking the "Data & Services" -> "Web Services" panel within the CF control panel, only the web service "http://api.domain.com/api/common.cfc?wsdl" is listed, and not testapi.domain.com......

If I reverse the order in which the WSDL's are loaded then this switches, and testapi.domain.com..... gets listed under "Web Services" but api.domain.com..... does not.  In essence it appears as though for some reason the CF server overwrites one with the other.  The exact "object undefined" error is proving difficult to reproduce reliably.

This appears to happen no matter which server is accessing the web service, be it the same server or a remote server.  All servers involved are running CF8.  Accessing the 2 WSDL files in a browser results in the 2 WSDLs being rendered correctly with different namespace values.

On the same server are 2 more services

     MYSERVICE2

     MYSERVICE2_test

These reside in the /api2 directories on the same 2 subdomains, api. and testapi.   MYSERVICE2 and MYSERVICE2_test appear to conflict with each other.  MYSERVICE and MYSERVICE_test appear to conflict with each other.  MYSERVICE and MYSERVICE2 do not appear to conflict with each other.

Is there a configuration change or anything like that which I should be aware of that would prevent me doing the above?  The 2 /api/ directories are nearly identical with the exception that the namespace and complex type names have been set to http://api.domain.com & MYSERVICE in the first, and http://testapi.domain.com & MYSERVICE_test in the second url.

I have also tried mapping /MYSERVICE and /MYSERVICE_test within /opt/coldfusion8/WEB-INF/jrun-web.xml to no avail.

Any help would be appreciated.  If there is any useful information that I have missed off please let me know and I'll dig it out.

- Simon H

This topic has been closed for replies.

1 reply

MSO_Simon
MSO_SimonAuthor
Participant
October 12, 2009

Hi,

As an extension to the above

Server                Test service         "Live" service

1 ("dev")                devtest                   devlive               http://dev(test/live).domain.com

2 ("test")                testtest                   testlive               http://test(test/live).domain.com

I currently have a test script (TEST1) that performs the following :

CreateObject + call method from devlive

CreateObject + call method from devtest

CreateObject + call method from testtest

The script errors on the third, when it attempts to call a method from devtest.  On the server on which this test script is running, by the end of this, there are the following 2 web services in the Coldfusion control panel :

http://devlive.domain.com/api/common.cfc?wsdl

http://testtest.domain.com/api/common.cfc?wsdl

I have a second test script (TEST2) on a second server distinctfrom the first test script server, on which the following is performed :

CreateObject + call method from testlive

If I execute TEST2, then it executes fine.  If I execute TEST1 straight after, then I receive the following error on TEST1

AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXException: Deserializing parameter 'objectFetchReturn':  could not find deserializer for type {http://common.types.WEBSERVICE_test}details

Where WEBSERVICE.types.common.details is a complex type (/api/types/common/details.cfc). If I then run the TEST2 script again straight after, the same error appears (with WEBSERVICE in place of WEBSERVICE_test).  If I execute TEST2 twice in a row, or TEST1 twice in a row, then the error disappears"test" server has got jrun-web.xml  edited to include the following, which "dev" does not.

  <virtual-mapping>
    <resource-path>/WEBSERVICE_test</resource-path>
    <system-path>/var/www/html/testapi.domain.com/api</system-path>
  </virtual-mapping>


  <virtual-mapping>
    <resource-path>/WEBSERVICE</resource-path>
    <system-path>/var/www/html/api.domain.com/api</system-path>
  </virtual-mapping>

I hope that this extended explaination helps.

Simon H

MSO_Simon
MSO_SimonAuthor
Participant
October 12, 2009

Hi,

As an extra bit, if I use the "Web Services" panel to define both web services and name them, and then CreateObject by name rather than url, this does not seem to cause errors, so I get a feeling this may be a solution.

Still doesn't really explain why this is the case though

- Simon H

October 12, 2009

I suspect that you problem is caused by DNS lookups, CF gets requests for different web services (live/test/dev) but becuase the names are identical itattempts to reslove the names and gets one IP address/name only...

This is my theory...