| Author |
Message |
< Yaws mailing list ~ missing SOAP handler crashes yaws |
| Guest |
Posted: Fri Jan 26, 2007 1:11 pm |
|
|
|
Guest
|
Hi
I actually have two questions,
where have I not managed to follow the online documentation for server
side SOAP, and
why does it crash yaws?
I've created get_locations.yaws and finally managed to create a WSDL
document that points to the location of get_locations.yaws. When I try
to test it using the WSDL validator at
http://www.mgateway.com/php/wsdlValidator/home.php, Yaws crashes.
By the info_report in get_locations.yaws it can be seen that Yaws finds
this file, but then yaws_soap_srv crashes with the error {error, "model
not found"}.
If you carefully read the attached log, you can see that I have set up
both ebin_dir in yaws.conf to /local/yaws/unprotected-docroot, and also
added it using code:add_path/1 like the online SOAP tutorial says. The
file get_locations.erl exists in that path, I have verified that it
compiles so there is also a get_locations.beam. Both these files are
world readable.
Thanks for any pointers
/Fredrik
Post recived from mailinglist |
|
|
| Back to top |
|
| tobbe |
Posted: Fri Jan 26, 2007 2:25 pm |
|
|
|
User
Joined: 19 Jan 2005
Posts: 274
Location: Stockholm, Sweden
|
Hm...I think there is an important piece missing in the docs...
On the server side, you need to call:
yaws_soap_srv:setup({?SOAP_HANDLER_MODULE, handler}, wsdl_file()).
--Tobbe
Fredrik Thulin skrev:
> Hi
>
> I actually have two questions,
>
> where have I not managed to follow the online documentation for server
> side SOAP, and
>
> why does it crash yaws?
>
> I've created get_locations.yaws and finally managed to create a WSDL
> document that points to the location of get_locations.yaws. When I try
> to test it using the WSDL validator at
> http://www.mgateway.com/php/wsdlValidator/home.php, Yaws crashes.
>
> By the info_report in get_locations.yaws it can be seen that Yaws finds
> this file, but then yaws_soap_srv crashes with the error {error, "model
> not found"}.
>
> If you carefully read the attached log, you can see that I have set up
> both ebin_dir in yaws.conf to /local/yaws/unprotected-docroot, and also
> added it using code:add_path/1 like the online SOAP tutorial says. The
> file get_locations.erl exists in that path, I have verified that it
> compiles so there is also a get_locations.beam. Both these files are
> world readable.
>
> Thanks for any pointers
>
> /Fredrik
>
>
> ------------------------------------------------------------------------
>
> root@s1 /local/yaws/unprotected-docroot # /local/yaws/start-yaws.sh -i
> Erlang (BEAM) emulator version 5.5.2 [source] [async-threads:0] [kernel-poll:false]
>
> Eshell V5.5.2 (abort with ^G)
> (yaws@s1.devel.sip.su.se)1>
> =INFO REPORT==== 26-Jan-2007::14:01:34 ===
> Yaws: Using config file /local/yaws/yaws.conf
> yaws:Add path "/local/yxa/build/src"
> yaws:Add path "/local/yxa/build/src/transportlayer"
> yaws:Add path "/local/yxa/build/src/transactionlayer"
> yaws:Add path "/local/yxa/build/src/cpl"
> yaws:Add path "/local/yxa/build/yaws/src"
> yaws:Add path "/pkg/yaws/default/lib/yaws/examples/ebin"
> yaws:Add path "/local/yaws/unprotected-docroot"
> yaws:Add path "/pkg/erlsom/cvs-2007-01-22/lib/erlsom-0.11/ebin"
> yaws:Add path "/pkg/yaws/1.66/lib/yaws/examples/ebin"
> yaws:Running with id=default
> Running with debug checks turned on (slower server)
> Logging to directory "/local/yaws/log"
>
> =INFO REPORT==== 26-Jan-2007::14:01:34 ===
> Yaws: Listening to 0.0.0.0:3443 for servers
> - https://s1.devel.sip.su.se:3443 under /local/yxa/trunk/yaws/docroot
>
> =INFO REPORT==== 26-Jan-2007::14:01:34 ===
> Yaws: Listening to 0.0.0.0:443 for servers
> - https://s1.devel.sip.su.se under /local/yaws/unprotected-docroot
>
> (yaws@s1.devel.sip.su.se)1> code:add_path("/local/yaws/unprotected-docroot").
> true
> (yaws@s1.devel.sip.su.se)2>
> =INFO REPORT==== 26-Jan-2007::14:01:51 ===
> FREDRIK: {arg,{sslsocket,7,<0.94.0>},
> {{81,149,149,152},2653},
> {headers,undefined,
> undefined,
> "s1.devel.sip.su.se",
> undefined,
> undefined,
> undefined,
> undefined,
> undefined,
> undefined,
> undefined,
> undefined,
> undefined,
> [],
> undefined,
> undefined,
> "480",
> "text/xml",
> undefined,
> undefined,
> undefined,
> [{http_header,7,
> 'Via',
> undefined,
> "1.1 - (DeleGate/8.10.1)"},
> {http_header,0,
> "Soapaction",
> undefined,
> "\"https://s1.devel.sip.su.se/get_locations.yaws\""}]},
> {http_request,'POST',{abs_path,"/get_locations.yaws"},{1,0}},
> <<"<?xml version='1.0'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:yxa='http://se.su.it.yxa.locations/GetLocations/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><SOAP-ENV:Body><GetLocationsRequest xsi:type='xsd:string'>foo</GetLocationsRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>\r\n">>,
> "/get_locations.yaws",
> [],
> undefined,
> "/local/yaws/unprotected-docroot",
> ["/local/yaws/unprotected-docroot","/get_locations.yaws"],
> undefined,
> undefined,
> <0.77.0>,
> [],
> undefined,
> undefined}
>
>
> =ERROR REPORT==== 26-Jan-2007::14:01:51 ===
> ** Generic server yaws_soap_srv terminating
> ** Last message in was {request,{get_locations,handler},
> "<?xml version='1.0'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:yxa='http://se.su.it.yxa.locations/GetLocations/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><SOAP-ENV:Body><GetLocationsRequest xsi:type='xsd:string'>foo</GetLocationsRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>\r\n",
> undefined,
> "\"https://s1.devel.sip.su.se/get_locations.yaws\""}
> ** When Server state == {s,[]}
> ** Reason for termination ==
> ** {{badmatch,{error,"model not found"}},
> [{yaws_soap_srv,request,5},
> {yaws_soap_srv,handle_call,3},
> {gen_server,handle_msg,6},
> {proc_lib,init_p,5}]}
>
> =ERROR REPORT==== 26-Jan-2007::14:01:51 ===
> {yaws_rpc,162,
> {get_locations,handler,
> {'EXIT',{{{badmatch,{error,"model not found"}},
> [{yaws_soap_srv,request,5},
> {yaws_soap_srv,handle_call,3},
> {gen_server,handle_msg,6},
> {proc_lib,init_p,5}]},
> {gen_server,
> call,
> [yaws_soap_srv,
> {request,
> {get_locations,handler},
> "<?xml version='1.0'?><SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:SOAP-ENC='http://schemas.xmlsoap.org/soap/encoding/' xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:yxa='http://se.su.it.yxa.locations/GetLocations/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><SOAP-ENV:Body><GetLocationsRequest xsi:type='xsd:string'>foo</GetLocationsRequest></SOAP-ENV:Body></SOAP-ENV:Envelope>\r\n",
> undefined,
> "\"https://s1.devel.sip.su.se/get_locations.yaws\""}]}}}}}
>
> =INFO REPORT==== 26-Jan-2007::14:01:51 ===
> application: yaws
> exited: shutdown
> type: permanent
> {"Kernel pid terminated",application_controller,"{application_terminated,yaws,shutdown}"}
>
> Crash dump was written to: erl_crash.dump
> Kernel pid terminated (application_controller) ({application_terminated,yaws,shutdown})
>
>
>
>
> root@s1 /local/yaws/unprotected-docroot # cat get_locations.yaws
> <erl>
> out(A) ->
> Msg = io_lib:format("FREDRIK: ~p~n", [A]),
> error_logger:info_report(lists:flatten(Msg)),
> yaws_rpc:handler_session(A, {get_locations, handler}).
> </erl>
> root@s1 /local/yaws/unprotected-docroot # cat get_locations.erl
> -module(get_locations).
> -export([handler/4]).
>
> -record('p:LocationList', {anyAttribs, 'location'}).
>
> handler(_Header, In, _Action, _SessionValue) ->
> Msg = io_lib:format("SOAP GetLocations : ~p~n", [In]),
> error_logger:info_report(lists:flatten(Msg)),
>
> {ok, undefined, get_locations(In)}.
>
> get_locations("foo") ->
> [#'p:LocationList'{location = "foo1"}];
> get_locations(_User) ->
> [].
> root@s1 /local/yaws/unprotected-docroot #
>
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Erlyaws-list mailing list
> Erlyaws-list@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/erlyaws-list
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist |
|
|
| Back to top |
|
| Guest |
Posted: Fri Jan 26, 2007 3:28 pm |
|
|
|
Guest
|
Torbjorn Tornkvist wrote:
> Hm...I think there is an important piece missing in the docs...
>
> On the server side, you need to call:
>
> yaws_soap_srv:setup({?SOAP_HANDLER_MODULE, handler}, wsdl_file()).
Thanks! That got me further. Now a call through the WDSL validator
actually invokes my code in get_locations.erl, although the second
argument is undefined, when I would have expected it to somehow contain
"foo" because the request sent by the validator contained
<SOAP-ENV:Body>
<GetLocationsRequest xsi:type='xsd:string'>
foo
</GetLocationsRequest>
</SOAP-ENV:Body>
Oh well - that might be an error in my WSDL. I'll try to debug it.
If you're going to update the online SOAP documentation, then please
change the sample SOAP server to use proper records. The current example
is IMO bad style, and perhaps also non-functional with Erlang R11B-2
that has strict record checks enabled per default. I took the liberty to
rewrite the example according to my own preference which also nicely
shows the overhead of SOAP :
get_weather_info(Place) ->
WeatherData =
#'p:WeatherData'{anyAttribs = [],
'Day' = "Sunday, December 10, 2006",
'WeatherImage' =
"http://www.nws.noaa.gov/weather/images/fcicons/nfew.jpg",
'MaxTemperatureF' = "51",
'MinTemperatureF' = "28",
'MaxTemperatureC' = "11",
'MinTemperatureC' = "-2"
},
ArrayOfWeatherData =
#'p:ArrayOfWeatherData'{anyAttribs = [],
'WeatherData' = [WeatherData]
},
Forecast =
#'p:WeatherForecasts'{anyAttribs = [],
'Latitude' = "40.3044128",
'Longitude' = "79.81284",
'AllocationFactor' = "0.000453",
'FipsCode' = "42",
'PlaceName' = Place,
'StateCode' = "PA",
'Status' = undefined,
'Details' = ArrayOfWeatherData
},
Response =
#'p:GetWeatherByPlaceNameResponse'{anyAttribs = [],
'GetWeatherByPlaceNameResult' = Forecast
},
[Response].
/Fredrik
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist |
|
|
| Back to top |
|
| tobbe |
Posted: Fri Jan 26, 2007 3:56 pm |
|
|
|
User
Joined: 19 Jan 2005
Posts: 274
Location: Stockholm, Sweden
|
Ok, done!
--Tobbe
Fredrik Thulin skrev:
> Torbjorn Tornkvist wrote:
>> Hm...I think there is an important piece missing in the docs...
>>
>> On the server side, you need to call:
>>
>> yaws_soap_srv:setup({?SOAP_HANDLER_MODULE, handler}, wsdl_file()).
>
> Thanks! That got me further. Now a call through the WDSL validator
> actually invokes my code in get_locations.erl, although the second
> argument is undefined, when I would have expected it to somehow contain
> "foo" because the request sent by the validator contained
>
> <SOAP-ENV:Body>
> <GetLocationsRequest xsi:type='xsd:string'>
> foo
> </GetLocationsRequest>
> </SOAP-ENV:Body>
>
> Oh well - that might be an error in my WSDL. I'll try to debug it.
>
> If you're going to update the online SOAP documentation, then please
> change the sample SOAP server to use proper records. The current example
> is IMO bad style, and perhaps also non-functional with Erlang R11B-2
> that has strict record checks enabled per default. I took the liberty to
> rewrite the example according to my own preference which also nicely
> shows the overhead of SOAP :
>
> get_weather_info(Place) ->
> WeatherData =
> #'p:WeatherData'{anyAttribs = [],
> 'Day' = "Sunday, December 10, 2006",
> 'WeatherImage' =
> "http://www.nws.noaa.gov/weather/images/fcicons/nfew.jpg",
> 'MaxTemperatureF' = "51",
> 'MinTemperatureF' = "28",
> 'MaxTemperatureC' = "11",
> 'MinTemperatureC' = "-2"
> },
>
> ArrayOfWeatherData =
> #'p:ArrayOfWeatherData'{anyAttribs = [],
> 'WeatherData' = [WeatherData]
> },
>
> Forecast =
> #'p:WeatherForecasts'{anyAttribs = [],
> 'Latitude' = "40.3044128",
> 'Longitude' = "79.81284",
> 'AllocationFactor' = "0.000453",
> 'FipsCode' = "42",
> 'PlaceName' = Place,
> 'StateCode' = "PA",
> 'Status' = undefined,
> 'Details' = ArrayOfWeatherData
> },
>
> Response =
> #'p:GetWeatherByPlaceNameResponse'{anyAttribs = [],
> 'GetWeatherByPlaceNameResult' = Forecast
> },
>
> [Response].
>
> /Fredrik
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Erlyaws-list mailing list
Erlyaws-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/erlyaws-list
Post recived from mailinglist |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|
|