Closed tandrew closed 9 years ago
Thanks for reporting, fixed and added test case.
facing same issue. but my error message is
Error: undefined: undefined at Object.Future.wait (C:\Users\Shyam\AppData\Local.meteor\packages\meteor-tool\1.1.10\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers\future.js:398:15) at packages/meteor/helpers.js:119:1 at [object Object].ViewRechargeDetails (packages/zardak_soap/packages/zardak_soap.js:18:1) at [object Object].Meteor.methods.recharge (server/recharge_api/recharge.js:12:1) at maybeAuditArgumentChecks (livedata_server.js:1698:12) at livedataserver.js:708:19 at [object Object]..extend.withValue (packages/meteor/dynamics_nodejs.js:56:1) at livedataserver.js:706:40 at [object Object]..extend.withValue (packages/meteor/dynamics_nodejs.js:56:1) at livedata_server.js:704:46
at [object Object].WSDL.xmlToObject (C:\Users\Shyam\AppData\Local.meteor\packages\zardak_soap\0.2.4\npm\node_modules\soap\lib\wsdl.js:1400:19)
at C:\Users\Shyam\AppData\Local.meteor\packages\zardak_soap\0.2.4\npm\node_modules\soap\lib\client.js:238:25
at Request._callback (C:\Users\Shyam\AppData\Local.meteor\packages\zardak_soap\0.2.4\npm\node_modules\soap\lib\http.js:109:5)
at Request.self.callback (C:\Users\Shyam\AppData\Local.meteor\packages\zardak_soap\0.2.4\npm\node_modules\soap\node_modules\request\request.js:198:22)
at Request.emit (events.js:98:17)
at Request.<anonymous> (C:\Users\Shyam\AppData\Local.meteor\packages\zardak_soap\0.2.4\npm\node_modules\soap\node_modules\request\request.js:1063:14)
at Request.emit (events.js:117:20)
at IncomingMessage.<anonymous> (C:\Users\Shyam\AppData\Local.meteor\packages\zardak_soap\0.2.4\npm\node_modules\soap\node_modules\request\request.js:1009:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at [object Object].WSDL.xmlToObject (C:\Users\Shyam\AppData\Local.meteor\packages\zardak_soap\0.2.4\npm\node_modules\soap\lib\wsdl.js:1400:19)
Are you sure your WSDL definition is correct? If it is, better open a new issue.
Let me confirm it, but i have only 2 methods in my wsdl that is working fine, the rest 8-10 methods all throw this issue. But i have deliberately NOT passed any arguments in the above example in order to check the returned error by the api service, but arguments or no arguments, its throwing this error which isnt supposed to throw like this, because the api service itself is configured to show pretty errors in case if any params is missing. So im confused.
Well, the wrapper itself is pretty much transparent. I could try to fix it, but I need to be able to replicate the error. In the meantime, consider checking whether it's a bug in node-soap itself.
I am bit new to SOAP. I will paste here the requests that i have been making.
Endpoint URL: http://115.248.39.80/hermesapi/hermesmobile.asmx
Original Soap Request to be send in XML format:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:her="http://tempuri.org/HERMESAPI/HermesMobile/">
<soapenv:Header>
<her:clsSecurity>
<her:WebProviderId>0</her:WebProviderId>
<!--Optional:-->
<her:WebProviderLoginId>Tarehub</her:WebProviderLoginId>
<!--Optional:-->
<her:WebProviderPassword>Tarehub123</her:WebProviderPassword>
<her:IsAgent>false</her:IsAgent>
</her:clsSecurity>
</soapenv:Header>
<soapenv:Body>
<her:GETRECHARGEDETAILS>
<!--Optional:-->
<her:pobjSecurity>
<!--Optional:-->
<her:WebProviderLoginId>Tarehub</her:WebProviderLoginId>
<!--Optional:-->
<her:WebProviderPassword>Tarehub123</her:WebProviderPassword>
<her:IsAgent>false</her:IsAgent>
</her:pobjSecurity>
</her:GETRECHARGEDETAILS>
</soapenv:Body>
</soapenv:Envelope>
For the above XML, i have written the meteor-soap code(in server) as
Soap.createClient("http://115.248.39.80/hermesapi/hermesmobile.asmx?WSDL").GETRECHARGEDETAILS({ pobjSecurity : {'WebProviderId': 0, 'WebProviderLoginId': 'Tarehub', 'WebProviderPassword': 'Tarehub123', 'IsAgent': 'false'}})
and the above code returns the expected response, according to the XML response i should get.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<clsSecurity xmlns="http://tempuri.org/HERMESAPI/HermesMobile/">
<WebProviderId>0</WebProviderId>
<WebProviderLoginId>Tarehub</WebProviderLoginId>
<WebProviderPassword>Tarehub123</WebProviderPassword>
<IsAgent>false</IsAgent>
</clsSecurity>
</soap:Header>
<soap:Body>
<GETRECHARGEDETAILSResponse xmlns="http://tempuri.org/HERMESAPI/HermesMobile/">
<GETRECHARGEDETAILSResult xsi:type="xsd:boolean">true</GETRECHARGEDETAILSResult>
<PstrFinalOutPut><![CDATA[<?xml version="1.0" encoding="utf-8" standalone="no"?>
<RechargeResponse>
<Item>
<Code>HACL</Code>
<Desc>AIRCEL</Desc>
<Commission>3.11</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HATL</Code>
<Desc>AIRTEL</Desc>
<Commission>1.50</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HADH</Code>
<Desc>AIRTEL DTH</Desc>
<Commission>2.03</Commission>
<ItemType>2</ItemType>
</Item>
<Item>
<Code>HBTV</Code>
<Desc>BIGTV</Desc>
<Commission>2.85</Commission>
<ItemType>2</ItemType>
</Item>
<Item>
<Code>HBSS</Code>
<Desc>BSNL</Desc>
<Commission>2.55</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HBST</Code>
<Desc>BSNL</Desc>
<Commission>2.55</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HDIS</Code>
<Desc>DISH TV </Desc>
<Commission>2.33</Commission>
<ItemType>2</ItemType>
</Item>
<Item>
<Code>HIDE</Code>
<Desc>IDEA</Desc>
<Commission>1.41</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HIDD</Code>
<Desc>IDEA DATACARD</Desc>
<Commission>1.28</Commission>
<ItemType>3</ItemType>
</Item>
<Item>
<Code>HBPL</Code>
<Desc>LOOP</Desc>
<Commission>3.03</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HMDT</Code>
<Desc>MTNL DELHI</Desc>
<Commission>3.13</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HMMD</Code>
<Desc>MTNL MUMBAI</Desc>
<Commission>3.49</Commission>
<ItemType>3</ItemType>
</Item>
<Item>
<Code>HMTN</Code>
<Desc>MTNL MUMBAI</Desc>
<Commission>3.49</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HMTS</Code>
<Desc>MTS</Desc>
<Commission>2.74</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HMTD</Code>
<Desc>MTS</Desc>
<Commission>2.85</Commission>
<ItemType>3</ItemType>
</Item>
<Item>
<Code>HREB</Code>
<Desc>RELIANCE BROADBAND</Desc>
<Commission>3.00</Commission>
<ItemType>3</ItemType>
</Item>
<Item>
<Code>HREC</Code>
<Desc>RELIANCE CDMA</Desc>
<Commission>3.75</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HRED</Code>
<Desc>RELIANCE DATACARD</Desc>
<Commission>3.75</Commission>
<ItemType>3</ItemType>
</Item>
<Item>
<Code>HREG</Code>
<Desc>RELIANCE GSM</Desc>
<Commission>3.75</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HSUN</Code>
<Desc>SUN DIRECT</Desc>
<Commission>3.13</Commission>
<ItemType>2</ItemType>
</Item>
<Item>
<Code>HTAD</Code>
<Desc>TATA DOCOMO</Desc>
<Commission>1.95</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HTDS</Code>
<Desc>TATA DOCOMO SPECIAL</Desc>
<Commission>1.95</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HTAI</Code>
<Desc>TATA INDICOM</Desc>
<Commission>1.95</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HTPP</Code>
<Desc>TATA PHOTON PLUS</Desc>
<Commission>1.95</Commission>
<ItemType>3</ItemType>
</Item>
<Item>
<Code>HUNI</Code>
<Desc>UNINOR</Desc>
<Commission>2.48</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HUNS</Code>
<Desc>UNINOR SPECIAL</Desc>
<Commission>2.48</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HVID</Code>
<Desc>VIDEOCON</Desc>
<Commission>3.04</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HVIH</Code>
<Desc>VIDEOCON D2H</Desc>
<Commission>3.26</Commission>
<ItemType>2</ItemType>
</Item>
<Item>
<Code>HVIS</Code>
<Desc>VIDEOCON SPECIAL</Desc>
<Commission>3.04</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HVIC</Code>
<Desc>VIRGIN CDMA</Desc>
<Commission>1.84</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HVIG</Code>
<Desc>VIRGIN GSM</Desc>
<Commission>1.84</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HVGS</Code>
<Desc>VIRGIN GSM SPECIAL</Desc>
<Commission>1.84</Commission>
<ItemType>1</ItemType>
</Item>
<Item>
<Code>HVDD</Code>
<Desc>VODAFONE</Desc>
<Commission>1.88</Commission>
<ItemType>3</ItemType>
</Item>
</RechargeResponse>]]></PstrFinalOutPut>
</GETRECHARGEDETAILSResponse>
</soap:Body>
</soap:Envelope>
But then, when i try another method, whose XML request is below.
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Header>
<ns1:clsSecurity soap:mustUnderstand="false" xmlns:ns1="http://tempuri.org/
WsHermes/Service1"><ns1:WebProviderId>0</ns1:WebProviderId>
<ns1:WebProviderLoginId>Tarehub</ns1:WebProviderLoginId>
<ns1:WebProviderPassword>Tarehub123</ns1:WebProviderPassword>
<ns1:IsAgent>false</ns1:IsAgent>
</ns1:clsSecurity>
</soap:Header>
<soap:Body>
<MOBILEBOOKINGDETAILS xmlns="http://tempuri.org/HERMESAPI/HermesMobile/">
<pobjSecurity><WebProviderId>0</WebProviderId><WebProviderLoginId>Tarehub</WebProviderLoginId><WebProviderPassword>Tarehub123</WebProviderPassword><IsAgent>false</IsAgent></pobjSecurity>
<PstrInput><MobileBookingRequest><UsertrackId>IsNRPR03000DD032G07012012080432</UsertrackId><Itemid>HACL</Itemid><ItemDesc>BSNLC</ItemDesc><MobileNo>9944100866</MobileNo><Amount>10</Amount><StoreId>0</StoreId></MobileBookingRequest>
</PstrInput>
<PstrFinalOutPut />
<pstrError />
</MOBILEBOOKINGDETAILS>
</soap:Body>
</soap:Envelope>
and my corresponding meteor-soap request is ,
Soap.createClient("http://115.248.39.80/hermesapi/hermesmobile.asmx?WSDL").MOBILEBOOKINGDETAILS({ pobjSecurity : {'WebProviderId': 0, 'WebProviderLoginId': 'Tarehub', 'WebProviderPassword': 'Tarehub123', 'IsAgent': 'false'}, PstrInput: "<MobileBookingRequest><UsertrackId>IsNRPR03000DD032G07012012080432</UsertrackId><Itemid>HACL</Itemid><ItemDesc>BSNLC</ItemDesc><MobileNo>9944100866</MobileNo><Amount>10</Amount><StoreId>0</StoreId></MobileBookingRequest>" })
which is throwing me that error which i mentioned earlier
Let me know how shall i work around this.. thank you.
This is the expected response in XML format,
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<MOBILEBOOKINGDETAILSResponse xmlns="http://tempuri.org/HERMESAPI/HermesMobile/">
<MOBILEBOOKINGDETAILSResult xsi:type="xsd:boolean">true</MOBILEBOOKINGDETAILSResult>
<PstrFinalOutPut><![CDATA[<?xml version="1.0" encoding="utf-8" standalone="no"?>
<MobileBookingResponse>
<Status>1</Status>
<TrackId>INTRV03000000S04122013133909</TrackId>
<RefNo>D3SZ9A</RefNo>
<TransNo>D3SZ9A</TransNo>
<Remarks />
<ItemDescription>RELIANCE</ItemDescription>
<MobileNumber>01505057883</MobileNumber>
<Amount>200</Amount>
<DateTime>24/05/2014 05:02:23 PM</DateTime>
</MobileBookingResponse>]]></PstrFinalOutPut>
<pstrError/>
</MOBILEBOOKINGDETAILSResponse>
</soap:Body>
</soap:Envelope>
Here's nodejs code that i ran
var soap = require('soap');
soap.createClient('http://115.248.39.80/hermesapi/hermesmobile.asmx?WSDL', function(err, client) {
var args = { pobjSecurity : {'WebProviderId': 0, 'WebProviderLoginId': 'Tarehub', 'WebProviderPassword': 'Tarehub123', 'IsAgent': 'false'}, PstrInput: "<MobileBookingRequest><UsertrackId>IsNRPR03000DD032G07012012080432</UsertrackId><Itemid>HACL</Itemid><ItemDesc>BSNLC</ItemDesc><MobileNo>9944100866</MobileNo><Amount>10</Amount><StoreId>0</StoreId></MobileBookingRequest>" };
client.MOBILEBOOKINGDETAILS(args, function(err, result, raw) {
console.log(err);
});
});
It returns the error
[Error: soap:Server: Server was unable to process request. ---> Data at the root level is invalid. Line 1, position 1.]
So, your issue is definitely not related to the package itself. It either may be node-soap, or invalid request data. Although, I'll try to fix error passing to make things clearer.
Just a note, the original error returned by node-soap can be accessed as .details property on thrown error.
try {
Soap.METHOD({...});
} catch (e) {
console.dir(e);
}
Thanks for clarifying this zardak, i suspect that i am not passing that value inside that "PstrInput" key correctly, perhaps i need to send it as an XML itself and not as a string like
<MobileBookingRequest><UsertrackId>IsNRPR03000DD032G07012012080432</UsertrackId><Itemid>HACL</Itemid><ItemDesc>BSNLC</ItemDesc><MobileNo>9944100866</MobileNo><Amount>10</Amount><StoreId>0</StoreId></MobileBookingRequest>
, as the methods that involve this PstrInput key are the ones returning the errors. The first method that i quoted as an example, it doesnt give an error, because it doesnt require this PstrInput key to be in the request. Atleast this is what i am able to comprehend as of now, will keep you updated on the progress.
I choose to pass that value as string itself, because i was using this approach with my ruby-rails app also using a bundle called "savon", which had worked well in that. And the api support team had also told me to pass that as string so thats why i sticked to that formula. So let me rinse-and-repeat the process now, i will update you when i get an output.
So silly of me Zardak!, the whole time, i was thinking of passing that as pure string, as it actually required me to pass that as XML !, just like this :
"<MobileBookingRequest><UsertrackId>IsNRPR03000DD032G07012012080432</UsertrackId><Itemid>HACL</Itemid><ItemDesc>BSNLC</ItemDesc><MobileNo>9944100866</MobileNo><Amount>10</Amount><StoreId>0</StoreId></MobileBookingRequest>"
instead of like this, (which is the wrong way)
"<MobileBookingRequest><UsertrackId>IsNRPR03000DD032G07012012080432</UsertrackId><Itemid>HACL</Itemid><ItemDesc>BSNLC</ItemDesc><MobileNo>9944100866</MobileNo><Amount>10</Amount><StoreId>0</StoreId></MobileBookingRequest>"
I feel so dumb! Thanks though for guiding me in the right direction. Much appreciate! :+1:
Hi, I am new to node and meteor, but somehow I would have thought that this examples works:
I get the following error:
It works fine in a pure nodejs application:
Where am I wrong? Thanks for any help.
Andrew