Solved

How to consume XML WSDL with Header Authentication?

Posted on 2010-11-29
3
1,373 Views
Last Modified: 2013-11-19
I have a web service I'm trying to program to.  I've used other web services (XML) fine, but this one is perplexing me; as it requires header authentication.

The CSHARP XML WSDL is:

http://api.zxxds.net/?wsdl&csharp

The documentation for it is at http://api.zedo.com/doc/

I'm interested in doing simple operations such as getChannel, and createChannel

Any help would be greatly appreciated....
0
Comment
Question by:adworldmedia
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 6

Accepted Solution

by:
r3nder earned 250 total points
ID: 34231308
Its just authentication - real simple
http://www.codeproject.com/KB/cpp/authforwebservices.aspx
Get channel is just
-------------------------------------------
public: static IChannel GetChannel( String name);
-------------------------------------------
CreateChannel() in code below



IChannelFactory<IRequestChannel> factory = binding.BuildChannelFactory<IRequestChannel>(bindingParams);
factory.Open();
EndpointAddress address = new EndpointAddress("http://localhost:8000/ChannelApp");
IRequestChannel channel = factory.CreateChannel(address);
channel.Open();

Open in new window

0
 
LVL 29

Assisted Solution

by:Kumaraswamy R
Kumaraswamy R earned 250 total points
ID: 34238246
0
 

Author Comment

by:adworldmedia
ID: 34257919
Thanks for the replies, but neither of them really are helping me much...  I've attached a snippet of java code, that does what I want.  I would need it converted to Asp.net C#.. any one that can help, thanks in advance!
import com.zedo.zapi.*;
import com.zedo.zapi.ZEDOAPIStub.*;
import javax.xml.namespace.QName;
import org.apache.axis2.AxisFault;

public class GetChannelTest {

    public static void main(String[] args) {
        GetChannelTest.getChannelTest();
    }

    private static void getChannelTest() {
        
        try {
          
            ZEDOAPIStub stub = new ZEDOAPIStub("http://api.zedo.com/v3/?wsdl&java");

                stub._getServiceClient().addStringHeader(new QName("http://api.zedo.com", "user", "zedoapi"),     "example@example.com");
                stub._getServiceClient().addStringHeader(new QName("http://api.zedo.com", "password", "zedoapi"),     "password");
            stub._getServiceClient().addStringHeader(new QName("http://api.zedo.com", "network", "zedoapi"),  "525");
            stub._getServiceClient().getOptions().setTimeOutInMilliSeconds(10 * 60 * 1000);
            
            GetChannel gc = new GetChannel();
            gc.setParam0(123123);
            Thread.sleep(5000);
            Channel c = stub.getChannel(gc).get_return();
    
            System.out.println("GET_CHANNEL COMPLETE!");
            System.out.println("PLEASE: " + c.getId() + " " + c.getName());

        } catch (Exception e) {
            System.err.println("ERROR: GET_CHANNEL FAILED!");
            System.err.println("Exception: " + e.getMessage());
            if (e instanceof AxisFault) {
                AxisFault af = (AxisFault) e;
                System.err.println("AxisFault's detail: " + af.getDetail());
                af.printStackTrace();
            } else {
                e.printStackTrace();
            }
        }
    }
}

Open in new window

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question