GithubHelp home page GithubHelp logo

devinus / detergent Goto Github PK

View Code? Open in Web Editor NEW
63.0 5.0 41.0 371 KB

An emulsifying Erlang SOAP library

Home Page: http://github.com/devinus/detergent

License: BSD 3-Clause "New" or "Revised" License

Makefile 0.18% Erlang 98.79% Elixir 1.03%

detergent's Introduction

Detergent - An emulsifying Erlang SOAP library

Detergent helps make SOAP interactions in Erlang uhh... cleaner (pun totally intended)!

History

Most code in Detergent was originally extracted from the SOAP implementation in Yaws, the idea being to make this more readily available without having to install Yaws itself.

There are obviously changes in Detergent that make it different from the Yaws implementation, and these will continue. Hopefully these changes make Detergent easier to use.

Dependencies

Detergent depends on the excellent Erlsom library for all XML interactions. Erlsom takes away quite a bit of the pain of working with XML.

Building

Detergent uses rebar for building and wraps it i a Makefile for convenience.

First clone Detergent from GitHub:

$ git clone git://github.com/devinus/detergent.git

Then change into the newly created directory:

$ cd detergent

And make:

$ make

Rebar will first pull in Erlsom as a dependency from GitHub, attempt to build it, then build Detergent.

Testing

To test your Detergent build, start an Erlang shell and run the detergent:qtest/0 function.

The qtest/0 function attempts to call a web service at webservicex.net to retrieve the weather repeat for Boston.

$ erl -pa deps/erlsom/ebin ebin
> inets:start().
> detergent:qtest().

License

Most code is copyright (c) 2006 by Claes Wikstrom and you can find his license in LICENSE.

Anything else is provided under public domain which you can learn more about in UNLICENSE.

detergent's People

Contributors

essiene avatar onkel-dirtus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

detergent's Issues

qtest example does not seem to work

When running detergent:qtest(). you get a reply saying that the site has moved. I tried to update the qtest function with the new location but could not get it to work, got some error about an include file that could not be found. I tried another site that works, i suggest that the qtest function is updated with:

detergent:call("http://www.webservicex.net/geoipservice.asmx?WSDL", "GetGeoIP",["68.69.60.1"]).

response is:

{ok,undefined,[{'p:GetGeoIPResponse',[],{'p:GeoIP',[],1,"68.69.60.1","Success","United States","USA"}}]}

WSDL with multiple namespaces not parsed correctly

Apologies in advance for a really vague bug report.

I have a WSDL document with many namespaces. Namespace info is parsed, but all namespaces are assigned both prefixes P and the specified default prefix in the model. When I generate SOAP requests, incorrect namespace attributes are generated (P is missing, the specified prefix is set, but with a random namespace url).

I've tried created a soap_config document for erlsom, but this did not seem to help. I'm using this to initialise models for both write_hrl and call steps.

makeOptions seems to pass namespace information back in a random format, not that which is required by erlsom - {namespaces, [{ns, Prefix, Url}]}. I changed this, but no improvement.

The definitions element of the WSDL begins like this (actual namespace urls obfuscated):

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://impl.example.com" xmlns:intf="http://intf.example.com" xmlns:tns1="http://tns1.example.com" xmlns:tns10="http://tns10.example.com" xmlns:tns11="http://tns11.example.com" xmlns:tns12="http://tns12.example.com" xmlns:tns13="http://tns13.example.com" xmlns:tns14="http://tns14.example.com" xmlns:tns2="http://tns2.example.com" xmlns:tns3="http://tns3.example.com" xmlns:tns4="http://tns4.example.com" xmlns:tns5="http://tns5.example.com" xmlns:tns6="http://tns6.example.com" xmlns:tns7="http://tns7.example.com" xmlns:tns8="http://tns8.example.com" xmlns:tns9="http://tns9.example.com" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://impl.example.com"> 

When I call write_hrl, I expect to see records for each of these namespaces. I just see records in the soap, P, _document- and specified default prefixes.

When I call call passing records from various namespaces, I expect to see the appropriate namespaces defined in the output SOAP request, i.e. lots of xmlns attributes.

wsdl not parsing

I just get this, I'm not really sure where to go with it.

Here's the asmx: https://gist.github.com/aaronjensen/02bd08019b8eff1dafa2

And the error:

** (MatchError) no match of right hand side value: {:error, [exception: {:error, 'Missing attribute: name'}, stack: [:localAttributeType, :globalComplexTypeType, :schemaType, :"wsdl:tTypes", :"wsdl:anyTopLevelOptionalElement", :"wsdl:tDefinitions"], received: {:startElement, 'http://www.w3.org/2001/XMLSchema', 'simpleType', 's', []}]}
    src/detergent.erl:338: :detergent.parseWsdls/5
    src/detergent.erl:320: :detergent.initModel2/5

addSchemas results in trying to read undefined?

89> detergent:initModel("http://pastebin.com/raw.php?i=B09KWTsS").
Ns:"http://schemas.xmlsoap.org/soap/encoding/" Loc:undefined --> ** exception throw: {'EXIT',{{badmatch,{error,enoent}},
[{detergent,get_url_file,1,
[{file,"detergent.erl"},{line,441}]},
{detergent,'-find_file_fun/1-fun-0-',4,
[{file,"detergent.erl"},{line,424}]},
{detergent,addSchemas,6,[{file,"detergent.erl"},{line,401}]},
{detergent,parseWsdls,5,[{file,"detergent.erl"},{line,363}]},
{detergent,initModel2,5,
[{file,"detergent.erl"},{line,337}]}]}}
in function detergent:get_url_file/1 (detergent.erl, line 441)
in call from detergent:'-find_file_fun/1-fun-0-'/4 (detergent.erl, line 424)
in call from detergent:addSchemas/6 (detergent.erl, line 401)
in call from detergent:parseWsdls/5 (detergent.erl, line 363)
in call from detergent:initModel2/5 (detergent.erl, line 337)
90>
I am not too sure what the issue is.

Missing Test Cases for call/4

Hi, i want to use the call/4 method that involves sending header along with the request. i could not find tests for calll/4 mothod. There is only one test qtest() that uses call/3 method.

"Include file not found (undefined)" when calling initModel

I'm getting a problem when I try and initModel a remote WSDL file inside the init callback of a gen_server.

The code looks something like this:

WsdlUrl = "http://localhost:18555/?wsdl",
case detergent:initModel(WsdlUrl) of
  Wsdl when is_record(Wsdl, wsdl) ->
    error_logger:info_msg("WSDL: ~p~n", [Wsdl]),
    {ok, #state{wsdl = Wsdl, ids_port = IdsPort}};
  Reply ->
    error_logger:info_msg("Unknown message: ~p~n", [Reply]),
    {stop, unknown_error}
end.

And it causes this:

application: earlie_worker
exited: {{{badmatch,{error,"Include file not found (undefined)"}},
          [{detergent,addSchemas,5},
           {detergent,parseWsdls,5},
           {detergent,initModel2,5},
           {ew_runner,init,1},
           {gen_server,init_it,6},
           {proc_lib,init_p_do_apply,3}]},
         {ew_app,start,[normal,[]]}}
type: temporary

The WSDL in question is this: https://gist.github.com/1034317

I'm having trouble working out what's going wrong here. Any suggestions?

Handling HTTPS services.

How do you access SOAP services that use HTTPS?

When accessing through HTTPS, I get the error:
** (MatchError) no match of right hand side value: {:error, :enoent}
src/detergent.erl:411: :detergent.get_url_file/1

In looking at the code, it seems like only the case for HTTP is handled. Is this a missing feature, or do I need to call HTTPS services in a different way? I'm just getting familiar with the library, so not sure. Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.