bet365 / soap

Make it easy to use SOAP from Erlang
Apache License 2.0
200 stars 74 forks source link

XSD includes are expected in local file system #13

Closed mkrogemann closed 7 years ago

mkrogemann commented 7 years ago

When I try to parse a WSDL with remote XSD includes, the XSDs are expected in local file system which breaks the parsing:

soap:wsdl2erlang("http://reiseauskunftdritte.bahn.de/webservices/reiseauskunft/v1?wsdl").

Select client; yes, client only; ibrowse

...

** exception error: no match of right hand side value {error,"Include file not found http://reiseauskunftdritte.bahn.de:80/webservices/reiseauskunft/v1?xsd=3"} in function soap_parse_wsdl:add_schemas/5 (src/soap_parse_wsdl.erl, line 212) in call from soap_parse_wsdl:parse_wsdls/3 (src/soap_parse_wsdl.erl, line 146) in call from soap_parse_wsdl:file/4 (src/soap_parse_wsdl.erl, line 80) in call from soap_parse_wsdl:get_model/2 (src/soap_parse_wsdl.erl, line 55) in call from soap_parse_wsdl:get_namespaces/2 (src/soap_parse_wsdl.erl, line 66) in call from soap:wsdl2erlang/2 (src/soap.erl, line 313)

willemdj commented 7 years ago

You are right. It works for imports in the WSDL, but not if they are in the XSD part.

I'll fix it, probably this weekend.

willemdj commented 7 years ago

I created a fix, it is now possible to pass options to erlsom. It will still require some careful specification of the prefixes for the namespaces. See the test suite (test/soap_SUITE.erl) for and example.

mkrogemann commented 7 years ago

Thank you for providing a fix. I am struggling to get it to work though. This is what I tried so far: checkout your fork, then run make ct This triggers an error:

Running common tests...
/bin/sh: ./logs/raw.log: No such file or directory
make: [ct] Error 1 (ignored)
grep: logs/raw.log: No such file or directory

Ok, I create the logs folder (in project root), this yields:

Running common tests...
make: [ct] Error 1 (ignored)

I am probably overlooking something here or my environment may be lacking some requirement. Is there a switch that I can use to produce more diagnostic output? Here is my environment: erlang was installed using brew -- erlang: stable 19.1 (bottled), HEAD [pinned at 19.1] MacOS X -- 10.12.1

mkrogemann commented 7 years ago

I made progress. The crashing test had to do with my machine's hostname ("Can't set long node name! Please check your configuration"). Now I can run the tests but have some failures. I include the log at the end of this comment.

Do you get the same errors?

Converting "ebin" to "/Users/markus/dev/github/erlang/forks/soap/ebin" and re-inserting with add_patha/1
Converting "deps/erlsom/ebin" to "/Users/markus/dev/github/erlang/forks/soap/deps/erlsom/ebin" and re-inserting with add_patha/1
Converting "test/deps/cowboy/ebin" to "/Users/markus/dev/github/erlang/forks/soap/test/deps/cowboy/ebin" and re-inserting with add_patha/1
Converting "test/deps/cowlib/ebin" to "/Users/markus/dev/github/erlang/forks/soap/test/deps/cowlib/ebin" and re-inserting with add_patha/1
Converting "test/deps/erlsom/ebin" to "/Users/markus/dev/github/erlang/forks/soap/test/deps/erlsom/ebin" and re-inserting with add_patha/1
Converting "test/deps/ibrowse/ebin" to "/Users/markus/dev/github/erlang/forks/soap/test/deps/ibrowse/ebin" and re-inserting with add_patha/1
Converting "test/deps/mochiweb/ebin" to "/Users/markus/dev/github/erlang/forks/soap/test/deps/mochiweb/ebin" and re-inserting with add_patha/1
Converting "test/deps/ranch/ebin" to "/Users/markus/dev/github/erlang/forks/soap/test/deps/ranch/ebin" and re-inserting with add_patha/1

Common Test v1.12.3 starting (cwd is /Users/markus/dev/github/erlang/forks/soap)

Common Test: Running make in test directories...

CWD set to: "/Users/markus/dev/github/erlang/forks/soap/logs/ct_run.test@myserver.mydomainname.com.2016-11-15_20.38.45"

TEST INFO: 1 test(s), 64 case(s) in 1 suite(s)

Testing forks.soap: Starting test, 64 test cases
send_sms!
sending "This is a test SMS" to "12345678"
Result: {sendMessageResponse,"OK"}
send_sms!
send_sms!
sending "Hello there" to "+31234567890"
Result: {sendMessageResponse,"OK"}
send_sms!
send_sms!
sending "Hello there" to "+31234567890"
Result: {sendMessageResponse,"OK"}
send_sms!

=INFO REPORT==== 15-Nov-2016::20:38:46 ===
    application: cowboy
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:46 ===
    application: ranch
    exited: stopped
    type: temporary
send_sms!
sending "This is a test SMS" to "12345678"
Result: {sendMessageResponse,"OK"}

=INFO REPORT==== 15-Nov-2016::20:38:46 ===
    application: inets
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:47 ===
    application: cowboy
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:47 ===
    application: ranch
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:51 ===
    application: cowboy
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:51 ===
    application: ranch
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:51 ===
    application: cowboy
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:51 ===
    application: ranch
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:51 ===
    application: cowboy
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:51 ===
    application: ranch
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:58 ===
    application: cowboy
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:58 ===
    application: ranch
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:59 ===
    application: cowboy
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:59 ===
    application: ranch
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:05 ===
    application: cowboy
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:05 ===
    application: ranch
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:06 ===
    application: cowboy
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:06 ===
    application: ranch
    exited: stopped
    type: temporary

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
soap_parse_wsdl:add_model failed on line 549
Reason: {badmatch,{error,[{exception,{error,"Wrong Type in value for...}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Testing forks.soap: *** FAILED test case 54 of 64 ***

=INFO REPORT==== 15-Nov-2016::20:39:06 ===
    application: cowboy
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:06 ===
    application: ranch
    exited: stopped
    type: temporary

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
erlsom_write:processAttributes failed on line 435
Reason: thrown
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Error detected: thrown
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Testing forks.soap: *** FAILED test case 56 of 64 ***

=INFO REPORT==== 15-Nov-2016::20:39:07 ===
    application: cowboy
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:07 ===
    application: ranch
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:08 ===
    application: cowboy
    exited: stopped
    type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:08 ===
    application: ranch
    exited: stopped
    type: temporary
Testing forks.soap: TEST COMPLETE, 62 ok, 2 failed of 64 test cases

Updating /Users/markus/dev/github/erlang/forks/soap/logs/index.html ... done
Updating /Users/markus/dev/github/erlang/forks/soap/logs/all_runs.html ... done
willemdj commented 7 years ago

Hi,

I do get 1 error, but that is not related to this issue. It is the first one that you are seeing (It should be sorted out, though - something to do.)

It would be interesting if you could give more information about the second error. The best way to do that would be to look into the html files that are listed at the end of the test output (`

/Users/markus/dev/github/erlang/forks/soap/logs/index.html`).

However, I would not worry too much about the tests. The only reason why I mentioned them was to let you know that you can find an example of how to compile your wsdl in the file soap_SUITE.erl.

Regards, Willem

2016-11-15 20:41 GMT+01:00 Markus Krogemann notifications@github.com:

I made progress. The crashing test had to do with my machine's hostname ("Can't set long node name! Please check your configuration"). Now I can run the tests but have some failures. I include the log at the end of this comment.

Do you get the same errors?

Converting "ebin" to "/Users/markus/dev/github/erlang/forks/soap/ebin" and re-inserting with add_patha/1 Converting "deps/erlsom/ebin" to "/Users/markus/dev/github/erlang/forks/soap/deps/erlsom/ebin" and re-inserting with add_patha/1 Converting "test/deps/cowboy/ebin" to "/Users/markus/dev/github/erlang/forks/soap/test/deps/cowboy/ebin" and re-inserting with add_patha/1 Converting "test/deps/cowlib/ebin" to "/Users/markus/dev/github/erlang/forks/soap/test/deps/cowlib/ebin" and re-inserting with add_patha/1 Converting "test/deps/erlsom/ebin" to "/Users/markus/dev/github/erlang/forks/soap/test/deps/erlsom/ebin" and re-inserting with add_patha/1 Converting "test/deps/ibrowse/ebin" to "/Users/markus/dev/github/erlang/forks/soap/test/deps/ibrowse/ebin" and re-inserting with add_patha/1 Converting "test/deps/mochiweb/ebin" to "/Users/markus/dev/github/erlang/forks/soap/test/deps/mochiweb/ebin" and re-inserting with add_patha/1 Converting "test/deps/ranch/ebin" to "/Users/markus/dev/github/erlang/forks/soap/test/deps/ranch/ebin" and re-inserting with add_patha/1

Common Test v1.12.3 starting (cwd is /Users/markus/dev/github/erlang/forks/soap)

Common Test: Running make in test directories...

CWD set to: "/Users/markus/dev/github/erlang/forks/soap/logs/ct_run.test@myserver.mydomainname.com.2016-11-15_20.38.45"

TEST INFO: 1 test(s), 64 case(s) in 1 suite(s)

Testing forks.soap: Starting test, 64 test cases send_sms! sending "This is a test SMS" to "12345678" Result: {sendMessageResponse,"OK"} send_sms! send_sms! sending "Hello there" to "+31234567890" Result: {sendMessageResponse,"OK"} send_sms! send_sms! sending "Hello there" to "+31234567890" Result: {sendMessageResponse,"OK"} send_sms!

=INFO REPORT==== 15-Nov-2016::20:38:46 === application: cowboy exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:46 === application: ranch exited: stopped type: temporary send_sms! sending "This is a test SMS" to "12345678" Result: {sendMessageResponse,"OK"}

=INFO REPORT==== 15-Nov-2016::20:38:46 === application: inets exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:47 === application: cowboy exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:47 === application: ranch exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:51 === application: cowboy exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:51 === application: ranch exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:51 === application: cowboy exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:51 === application: ranch exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:51 === application: cowboy exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:51 === application: ranch exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:58 === application: cowboy exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:58 === application: ranch exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:59 === application: cowboy exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:38:59 === application: ranch exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:05 === application: cowboy exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:05 === application: ranch exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:06 === application: cowboy exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:06 === application: ranch exited: stopped type: temporary


soap_parse_wsdl:add_model failed on line 549 Reason: {badmatch,{error,[{exception,{error,"Wrong Type in value for...}


Testing forks.soap: * FAILED test case 54 of 64 *

=INFO REPORT==== 15-Nov-2016::20:39:06 === application: cowboy exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:06 === application: ranch exited: stopped type: temporary


erlsom_write:processAttributes failed on line 435 Reason: thrown



Error detected: thrown


Testing forks.soap: * FAILED test case 56 of 64 *

=INFO REPORT==== 15-Nov-2016::20:39:07 === application: cowboy exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:07 === application: ranch exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:08 === application: cowboy exited: stopped type: temporary

=INFO REPORT==== 15-Nov-2016::20:39:08 === application: ranch exited: stopped type: temporary Testing forks.soap: TEST COMPLETE, 62 ok, 2 failed of 64 test cases

Updating /Users/markus/dev/github/erlang/forks/soap/logs/index.html ... done Updating /Users/markus/dev/github/erlang/forks/soap/logs/all_runs.html ... done

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bet365/soap/issues/13#issuecomment-260744754, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJjx2A6eWBIQQiBQhrTgTZipcpgsHB4ks5q-grXgaJpZM4KtVbU .

mkrogemann commented 7 years ago

In my environment, I consistently have two errors. I have attached the complete logs folder, including the detailed test results. logs.tar.gz

willemdj commented 7 years ago

I can't explain it, but I'll look into it in more detail later. The second test definitely works on my machine, so there must be some environment factor.

I would be interested to know if the fix solved your problem with the Reiseauskunft WSDL?

Regards, Willem

2016-11-17 17:13 GMT+01:00 Markus Krogemann notifications@github.com:

In my environment, I consistently have two errors. I have attached the complete logs folder, including the detailed test results. logs.tar.gz https://github.com/bet365/soap/files/597860/logs.tar.gz

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bet365/soap/issues/13#issuecomment-261290583, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJjxxL0EV8hsulajt1zgvrK4h8WKJNcks5q_H0hgaJpZM4KtVbU .

mkrogemann commented 7 years ago

It looks like your fix has resolved the original problem. The test suite now compiles a test.hrl file and a client.erl. I cannot currently decide whether the transformation is complete, but all of the XSD files are now resolved, which I guess means that the artifacts represent the complete wsdl and all types.

Next step will be for me to create some proper payloads and then see if the interface actually works.

What I am aiming for is to use soap from within an Elixir app, so I will also have some interop work to do.

Thank You for the fix 👍