Web service interface - complex type as parameter?

Just find some best practice reviews regarding web service interface design.

I have two options:

Option 1

public string GetSomeData(SomeCriteriaClass criteria);

where SomeCriteriaClass is defined as:

public int ID;
public string Name;
public string Property2; etc.

Option 2

public string GetSomeData(int id, string name, string property2)

Which is your preferred option? It seems that the conflict of design patterns - 1 - is the completion of parameters in the class, and the other is the flexibility and openness of the web service interface.

Second question: if we choose Option1 - what do you call it using the URL?

thanks

+5
source share
3 answers

# 1, SOAP. SOAP . , "" , № 2, REST URL- HTTP POST.

+2

"-" .

  • : HTTP (S) .

  • : - .

- , : HTTP GET ( , URL) HTTP POST ( HTTP ). HTTP POST SOAP propriatery.

- , HTTP + SOAP .

- , , :

public FooResponse FooOperation(FooRequest request);

, ( ), ( ) ( ). . :

:

  • , SOA HTTP, 2 .
  • SOA, ", ". 1 .
+2

1 GetSomeData ( SomeCriteriaClass); webservice, SOAP . option2 Java, .

. 2 , 3 varibale SomeCriteriaClass.java, .. 3 GetSomeData() SomeCriteriaClass.java.

A good follower for a design template, select an ad in SomeCriteriaClass.java so as not to add to GetSomeData ().

+1
source

All Articles