simpligility / ksoap2-android

ksoap2-android - SOAP support for Android
http://simpligility.github.io/ksoap2-android/
Other
544 stars 247 forks source link

Unexpected wrapper element #104

Closed moonandroid closed 5 years ago

moonandroid commented 7 years ago

I'm soap for billing api. WSDL URL : http://94.206.70.106:8181/cxf/services/UnifiedPartner?wsdl My request is :

<?xml version="1.0" encoding="UTF-8"?>
<v:Envelope xmlns:v="http://schemas.xmlsoap.org/soap/envelope/" xmlns:c="http://schemas.xmlsoap.org/soap/encoding/" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
   <v:Header />
   <v:Body>
      <purchaseConsumeProduct xmlns="https://94.206.70.106:8181/">
       <userId>97XXXXXXX</userId>
         <serviceId>S-KXXXXX</serviceId>
         <premiumResourceType>MP-xxx-xx-xxxx-Sub-B2-D-xx</premiumResourceType>
         <productId>Daily MAP Test Sub V2 IN</productId>
         <purchaseMetas>
            <key>du:assetDescription</key>    
            <value>Subscription</value>
         </purchaseMetas>
         <!--Zero or more repetitions:-->
         <billingMetas>
            <key>du:assetID</key>
            <value>-</value>
         </billingMetas>
           <billingMetas>
            <key>du:contentType</key>
            <value>mobileApp</value>
         </billingMetas>
         <billingMetas>
            <key>du:channel</key>
            <value>COMMERCE_API</value>
         </billingMetas>
         <!--Zero or more repetitions:-->
         <usageMetas>
            <key>du:externalid</key>
            <value>S-XXXXXX</value>
         </usageMetas>
      </purchaseConsumeProduct>
   </v:Body>
</v:Envelope>

But they need like below

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.api.sdp.ericsson.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <ws:purchaseConsumeProduct>//Method name
         <userId>97XXXXXXX</userId>
         <serviceId>S-KXXXXX</serviceId>
         <premiumResourceType>MP-xxx-xx-xxxx-Sub-B2-D-xx</premiumResourceType>
         <productId>Daily MAP Test Sub V2 IN</productId>
         <purchaseMetas>
            <key>du:assetDescription</key>    
            <value>Subscription</value>
         </purchaseMetas>
         <!--Zero or more repetitions:-->
         <billingMetas>
            <key>du:assetID</key>
            <value>-</value>
         </billingMetas>
           <billingMetas>
            <key>du:contentType</key>
            <value>mobileApp</value>
         </billingMetas>
         <billingMetas>
            <key>du:channel</key>
            <value>COMMERCE_API</value>
         </billingMetas>
         <!--Zero or more repetitions:-->
         <usageMetas>
            <key>du:externalid</key>
            <value>S-XXXXXX</value>
         </usageMetas>
      </ws:purchaseConsumeProduct>
   </soapenv:Body>
</soapenv:Envelope>

How i can achieve above request with Ksoap.I have tried lots of way but not got any success. Please help me here.

robocik commented 7 years ago

Your wsdl url doesn't work but creating a correct code for complex soap message is quite hard task. My advice is to use some soap client generator for this. You can try http://easywsdl.com/ (I'm an author of this tool). It should help you with this task.

moonandroid commented 7 years ago

I have used above generator and got below error.

Wsdl contains external file which cannot be loaded. File: http://94.206.70.106:8181/cxf/services/UnifiedPartner?wsdl. See the FAQ how to solve this problem

robocik commented 7 years ago

Problem is that your web service is available locally only (there is no access from the internet). The easiest way to generate classes is to use our plugin EasyWSDL Plugin (for Android Studio and IntelliJ). Using it you should be able to generate classes for your web service

Kisty commented 7 years ago

There's also www.wsdl2code.com. That's what we used. Probably needs a little configuring but helped us. Didn't help when we went from http to https though.

mosabua commented 5 years ago

Closing old issue as part of cleanup